Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
85ee33b2
Commit
85ee33b2
authored
Oct 04, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wayland/shm: create a new file temporary file always, simplify
parent
a6535338
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
19 deletions
+16
-19
modules/video_output/wl/shm.c
modules/video_output/wl/shm.c
+16
-19
No files found.
modules/video_output/wl/shm.c
View file @
85ee33b2
...
...
@@ -52,7 +52,6 @@ struct vout_display_sys_t
picture_pool_t
*
pool
;
/* picture pool */
unsigned
char
*
base
;
size_t
length
;
int
fd
;
int
x
;
int
y
;
...
...
@@ -88,6 +87,15 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
if
(
req
>
MAX_PICTURES
)
req
=
MAX_PICTURES
;
char
bufpath
[]
=
"/tmp/"
PACKAGE_NAME
"XXXXXX"
;
int
fd
=
mkostemp
(
bufpath
,
O_CLOEXEC
);
if
(
fd
==
-
1
)
{
msg_Err
(
vd
,
"cannot create buffers: %s"
,
vlc_strerror_c
(
errno
));
return
NULL
;
}
unlink
(
bufpath
);
/* We need one extra line to cover for horizontal crop offset */
unsigned
stride
=
4
*
((
vd
->
fmt
.
i_width
+
31
)
&
~
31
);
unsigned
lines
=
(
vd
->
fmt
.
i_height
+
31
+
1
)
&
~
31
;
...
...
@@ -96,24 +104,27 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
sys
->
length
=
picsize
*
req
;
if
(
ftruncate
(
sys
->
fd
,
sys
->
length
))
if
(
ftruncate
(
fd
,
sys
->
length
))
{
msg_Err
(
vd
,
"cannot allocate buffers: %s"
,
vlc_strerror_c
(
errno
));
close
(
fd
);
return
NULL
;
}
sys
->
base
=
mmap
(
NULL
,
sys
->
length
,
PROT_READ
|
PROT_WRITE
,
MAP_SHARED
,
sys
->
fd
,
0
);
sys
->
base
=
mmap
(
NULL
,
sys
->
length
,
PROT_READ
|
PROT_WRITE
,
MAP_SHARED
,
fd
,
0
);
if
(
sys
->
base
==
MAP_FAILED
)
{
msg_Err
(
vd
,
"cannot map buffers: %s"
,
vlc_strerror_c
(
errno
));
close
(
fd
);
goto
error
;
}
#ifndef NDEBUG
memset
(
sys
->
base
,
0x80
,
sys
->
length
);
/* gray fill */
#endif
sys
->
shm_pool
=
wl_shm_create_pool
(
sys
->
shm
,
sys
->
fd
,
sys
->
length
);
sys
->
shm_pool
=
wl_shm_create_pool
(
sys
->
shm
,
fd
,
sys
->
length
);
close
(
fd
);
if
(
sys
->
shm_pool
==
NULL
)
goto
error
;
...
...
@@ -178,7 +189,6 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned req)
error:
if
(
sys
->
base
!=
MAP_FAILED
)
munmap
(
sys
->
base
,
sys
->
length
);
ftruncate
(
sys
->
fd
,
0
);
/* "free" memory */
return
NULL
;
}
...
...
@@ -372,19 +382,9 @@ static int Open(vlc_object_t *obj)
sys
->
eventq
=
NULL
;
sys
->
shm
=
NULL
;
sys
->
pool
=
NULL
;
sys
->
fd
=
-
1
;
sys
->
x
=
0
;
sys
->
y
=
0
;
char
bufpath
[]
=
"/tmp/"
PACKAGE_NAME
"XXXXXX"
;
sys
->
fd
=
mkostemp
(
bufpath
,
O_CLOEXEC
);
if
(
sys
->
fd
==
-
1
)
{
msg_Err
(
vd
,
"cannot create buffers: %s"
,
vlc_strerror_c
(
errno
));
goto
error
;
}
unlink
(
bufpath
);
/* Get window */
vout_window_cfg_t
wcfg
=
{
.
type
=
VOUT_WINDOW_TYPE_WAYLAND
,
...
...
@@ -445,8 +445,6 @@ error:
wl_event_queue_destroy
(
sys
->
eventq
);
if
(
sys
->
embed
!=
NULL
)
vout_display_DeleteWindow
(
vd
,
sys
->
embed
);
if
(
sys
->
fd
!=
-
1
)
close
(
sys
->
fd
);
free
(
sys
);
return
VLC_EGENERIC
;
}
...
...
@@ -462,7 +460,6 @@ static void Close(vlc_object_t *obj)
wl_display_flush
(
sys
->
embed
->
display
.
wl
);
wl_event_queue_destroy
(
sys
->
eventq
);
vout_display_DeleteWindow
(
vd
,
sys
->
embed
);
close
(
sys
->
fd
);
free
(
sys
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment