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
0a2313a5
Commit
0a2313a5
authored
Apr 18, 2014
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
directfb: use triple buffering
parent
3f2ac49d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
29 deletions
+71
-29
modules/video_output/directfb.c
modules/video_output/directfb.c
+71
-29
No files found.
modules/video_output/directfb.c
View file @
0a2313a5
...
...
@@ -62,10 +62,12 @@ static int Control(vout_display_t *, int, va_list);
/* */
struct
vout_display_sys_t
{
IDirectFB
*
directfb
;
IDirectFBSurface
*
primary
;
IDirectFB
*
directfb
;
IDirectFBSurface
*
primary
;
picture_pool_t
*
pool
;
picture_t
*
pics
[
3
];
int
idx
;
};
/* */
...
...
@@ -85,11 +87,13 @@ static int Open(vlc_object_t *object)
}
DFBSurfaceDescription
dsc
;
/*dsc.flags = DSDESC_CAPS | DSDESC_HEIGHT | DSDESC_WIDTH;*/
dsc
.
flags
=
DSDESC_CAPS
;
dsc
.
caps
=
DSCAPS_PRIMARY
|
DSCAPS_FLIPPING
;
/*dsc.width = 352;*/
/*dsc.height = 240;*/
dsc
.
caps
=
DSCAPS_PRIMARY
|
DSCAPS_TRIPLE
;
#if 0
dsc.flags |= DSDESC_HEIGHT | DSDESC_WIDTH;
dsc.width = 352;
dsc.height = 240;
#endif
IDirectFB
*
directfb
=
NULL
;
if
(
DirectFBCreate
(
&
directfb
)
!=
DFB_OK
||
!
directfb
)
...
...
@@ -106,8 +110,6 @@ static int Open(vlc_object_t *object)
int
height
;
primary
->
GetSize
(
primary
,
&
width
,
&
height
);
primary
->
FillRectangle
(
primary
,
0
,
0
,
width
,
height
);
primary
->
Flip
(
primary
,
NULL
,
0
);
vout_display_DeleteWindow
(
vd
,
NULL
);
...
...
@@ -183,42 +185,82 @@ static void Close(vlc_object_t *object)
free
(
sys
);
}
/* */
static
picture_pool_t
*
Pool
(
vout_display_t
*
vd
,
unsigned
count
)
{
vout_display_sys_t
*
sys
=
vd
->
sys
;
struct
picture_sys_t
{
vout_display_sys_t
*
sys
;
};
if
(
!
sys
->
pool
)
sys
->
pool
=
picture_pool_NewFromFormat
(
&
vd
->
fmt
,
count
);
return
sys
->
pool
;
static
int
Lock
(
picture_t
*
pic
)
{
vout_display_sys_t
*
sys
=
pic
->
p_sys
->
sys
;
return
sys
->
pics
[
sys
->
idx
]
==
pic
?
VLC_SUCCESS
:
VLC_EGENERIC
;
}
static
void
Display
(
vout_display_t
*
vd
,
picture_t
*
picture
,
subpicture_t
*
subpicture
)
/* */
static
picture_pool_t
*
Pool
(
vout_display_t
*
vd
,
unsigned
count
)
{
VLC_UNUSED
(
count
);
vout_display_sys_t
*
sys
=
vd
->
sys
;
IDirectFBSurface
*
primary
=
sys
->
primary
;
void
*
pixels
;
int
pitch
;
if
(
primary
->
Lock
(
primary
,
DSLF_WRITE
,
&
pixels
,
&
pitch
)
==
DFB_OK
)
{
if
(
!
sys
->
pool
)
{
picture_resource_t
rsc
;
memset
(
&
rsc
,
0
,
sizeof
(
rsc
));
rsc
.
p
[
0
].
p_pixels
=
pixels
;
rsc
.
p
[
0
].
i_lines
=
vd
->
fmt
.
i_height
;
rsc
.
p
[
0
].
i_pitch
=
pitch
;
picture_t
*
direct
=
picture_NewFromResource
(
&
vd
->
fmt
,
&
rsc
);
if
(
direct
)
{
picture_Copy
(
direct
,
picture
);
picture_Release
(
direct
);
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
rsc
.
p_sys
=
malloc
(
sizeof
(
*
rsc
.
p_sys
));
if
(
!
rsc
.
p_sys
)
goto
cleanup
;
rsc
.
p_sys
->
sys
=
sys
;
void
*
pixels
;
int
pitch
;
if
(
primary
->
Lock
(
primary
,
DSLF_WRITE
,
&
pixels
,
&
pitch
)
!=
DFB_OK
)
goto
cleanup
;
rsc
.
p
[
0
].
i_pitch
=
pitch
;
rsc
.
p
[
0
].
p_pixels
=
pixels
;
primary
->
Unlock
(
primary
);
primary
->
Flip
(
primary
,
NULL
,
0
);
sys
->
pics
[
i
]
=
picture_NewFromResource
(
&
vd
->
fmt
,
&
rsc
);
if
(
!
sys
->
pics
[
i
])
{
free
(
rsc
.
p_sys
);
goto
cleanup
;
}
}
if
(
primary
->
Unlock
(
primary
)
==
DFB_OK
)
primary
->
Flip
(
primary
,
NULL
,
0
);
picture_pool_configuration_t
cfg
=
{
.
picture_count
=
3
,
.
picture
=
sys
->
pics
,
.
lock
=
Lock
,
.
unlock
=
NULL
,
};
sys
->
pool
=
picture_pool_NewExtended
(
&
cfg
);
}
return
sys
->
pool
;
cleanup:
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
if
(
sys
->
pics
[
i
])
{
free
(
sys
->
pics
[
i
]
->
p_sys
);
picture_Release
(
sys
->
pics
[
i
]);
}
}
return
NULL
;
}
static
void
Display
(
vout_display_t
*
vd
,
picture_t
*
picture
,
subpicture_t
*
subpicture
)
{
vout_display_sys_t
*
sys
=
vd
->
sys
;
IDirectFBSurface
*
primary
=
sys
->
primary
;
primary
->
Flip
(
primary
,
NULL
,
0
);
if
(
++
sys
->
idx
>=
3
)
sys
->
idx
=
0
;
picture_Release
(
picture
);
VLC_UNUSED
(
subpicture
);
}
...
...
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