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
d1774818
Commit
d1774818
authored
Jul 29, 2014
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vdpau/chroma: set up device and mixer from the init function
parent
9d8b3af7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
59 deletions
+37
-59
modules/hw/vdpau/chroma.c
modules/hw/vdpau/chroma.c
+37
-59
No files found.
modules/hw/vdpau/chroma.c
View file @
d1774818
...
@@ -279,37 +279,6 @@ static void Flush(filter_t *filter)
...
@@ -279,37 +279,6 @@ static void Flush(filter_t *filter)
}
}
}
}
/** Get a VLC picture for a VDPAU output surface */
static
picture_t
*
OutputAllocate
(
filter_t
*
filter
)
{
filter_sys_t
*
sys
=
filter
->
p_sys
;
picture_t
*
pic
=
filter_NewPicture
(
filter
);
if
(
pic
==
NULL
)
return
NULL
;
picture_sys_t
*
psys
=
pic
->
p_sys
;
assert
(
psys
->
vdp
!=
NULL
);
if
(
likely
(
sys
->
mixer
!=
VDP_INVALID_HANDLE
))
{
/* Not the first output picture */
assert
(
psys
->
vdp
==
sys
->
vdp
);
return
pic
;
}
/* First picture: get the context and allocate the mixer */
sys
->
vdp
=
vdp_hold_x11
(
psys
->
vdp
,
NULL
);
sys
->
device
=
psys
->
device
;
sys
->
mixer
=
MixerCreate
(
filter
);
if
(
sys
->
mixer
!=
VDP_INVALID_HANDLE
)
return
pic
;
vdp_release_x11
(
psys
->
vdp
);
psys
->
vdp
=
NULL
;
picture_Release
(
pic
);
return
NULL
;
}
/** Export a VDPAU video surface picture to a normal VLC picture */
/** Export a VDPAU video surface picture to a normal VLC picture */
static
picture_t
*
VideoExport
(
filter_t
*
filter
,
picture_t
*
src
,
picture_t
*
dst
)
static
picture_t
*
VideoExport
(
filter_t
*
filter
,
picture_t
*
src
,
picture_t
*
dst
)
{
{
...
@@ -444,6 +413,7 @@ static inline VdpVideoSurface picture_GetVideoSurface(const picture_t *pic)
...
@@ -444,6 +413,7 @@ static inline VdpVideoSurface picture_GetVideoSurface(const picture_t *pic)
static
picture_t
*
VideoRender
(
filter_t
*
filter
,
picture_t
*
src
)
static
picture_t
*
VideoRender
(
filter_t
*
filter
,
picture_t
*
src
)
{
{
filter_sys_t
*
sys
=
filter
->
p_sys
;
filter_sys_t
*
sys
=
filter
->
p_sys
;
picture_t
*
dst
=
NULL
;
VdpStatus
err
;
VdpStatus
err
;
if
(
unlikely
(
src
->
context
==
NULL
))
if
(
unlikely
(
src
->
context
==
NULL
))
...
@@ -453,8 +423,6 @@ static picture_t *VideoRender(filter_t *filter, picture_t *src)
...
@@ -453,8 +423,6 @@ static picture_t *VideoRender(filter_t *filter, picture_t *src)
return
NULL
;
return
NULL
;
}
}
picture_t
*
dst
=
OutputAllocate
(
filter
);
/* Corner case: different VDPAU instances decoding and rendering */
/* Corner case: different VDPAU instances decoding and rendering */
vlc_vdp_video_field_t
*
field
=
src
->
context
;
vlc_vdp_video_field_t
*
field
=
src
->
context
;
if
(
field
->
frame
->
vdp
!=
sys
->
vdp
)
if
(
field
->
frame
->
vdp
!=
sys
->
vdp
)
...
@@ -496,13 +464,16 @@ static picture_t *VideoRender(filter_t *filter, picture_t *src)
...
@@ -496,13 +464,16 @@ static picture_t *VideoRender(filter_t *filter, picture_t *src)
else
else
sys
->
history
[
MAX_PAST
+
MAX_FUTURE
].
field
=
NULL
;
sys
->
history
[
MAX_PAST
+
MAX_FUTURE
].
field
=
NULL
;
if
(
dst
==
NULL
)
goto
skip
;
vlc_vdp_video_field_t
*
f
=
sys
->
history
[
MAX_PAST
].
field
;
vlc_vdp_video_field_t
*
f
=
sys
->
history
[
MAX_PAST
].
field
;
if
(
f
==
NULL
)
if
(
f
==
NULL
)
goto
error
;
goto
skip
;
/* Get a VLC picture for a VDPAU output surface */
dst
=
filter_NewPicture
(
filter
);
if
(
dst
==
NULL
)
goto
skip
;
assert
(
dst
->
p_sys
!=
NULL
&&
dst
->
p_sys
->
vdp
==
sys
->
vdp
);
dst
->
date
=
sys
->
history
[
MAX_PAST
].
date
;
dst
->
date
=
sys
->
history
[
MAX_PAST
].
date
;
dst
->
b_force
=
sys
->
history
[
MAX_PAST
].
force
;
dst
->
b_force
=
sys
->
history
[
MAX_PAST
].
force
;
...
@@ -675,14 +646,6 @@ error:
...
@@ -675,14 +646,6 @@ error:
static
picture_t
*
YCbCrRender
(
filter_t
*
filter
,
picture_t
*
src
)
static
picture_t
*
YCbCrRender
(
filter_t
*
filter
,
picture_t
*
src
)
{
{
/* FIXME: Define a way to initialize the mixer in Open() instead. */
if
(
unlikely
(
filter
->
p_sys
->
vdp
==
NULL
))
{
picture_t
*
dummy
=
OutputAllocate
(
filter
);
if
(
dummy
!=
NULL
)
picture_Release
(
dummy
);
}
src
=
VideoImport
(
filter
,
src
);
src
=
VideoImport
(
filter
,
src
);
return
(
src
!=
NULL
)
?
VideoRender
(
filter
,
src
)
:
NULL
;
return
(
src
!=
NULL
)
?
VideoRender
(
filter
,
src
)
:
NULL
;
}
}
...
@@ -690,6 +653,7 @@ static picture_t *YCbCrRender(filter_t *filter, picture_t *src)
...
@@ -690,6 +653,7 @@ static picture_t *YCbCrRender(filter_t *filter, picture_t *src)
static
int
OutputOpen
(
vlc_object_t
*
obj
)
static
int
OutputOpen
(
vlc_object_t
*
obj
)
{
{
filter_t
*
filter
=
(
filter_t
*
)
obj
;
filter_t
*
filter
=
(
filter_t
*
)
obj
;
if
(
filter
->
fmt_out
.
video
.
i_chroma
!=
VLC_CODEC_VDPAU_OUTPUT
)
if
(
filter
->
fmt_out
.
video
.
i_chroma
!=
VLC_CODEC_VDPAU_OUTPUT
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
...
@@ -699,14 +663,14 @@ static int OutputOpen(vlc_object_t *obj)
...
@@ -699,14 +663,14 @@ static int OutputOpen(vlc_object_t *obj)
if
(
unlikely
(
sys
==
NULL
))
if
(
unlikely
(
sys
==
NULL
))
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
sys
->
vdp
=
NULL
;
filter
->
p_sys
=
sys
;
sys
->
mixer
=
VDP_INVALID_HANDLE
;
picture_t
*
(
*
video_filter
)(
filter_t
*
,
picture_t
*
)
=
VideoRender
;
if
(
filter
->
fmt_in
.
video
.
i_chroma
==
VLC_CODEC_VDPAU_VIDEO_444
)
if
(
filter
->
fmt_in
.
video
.
i_chroma
==
VLC_CODEC_VDPAU_VIDEO_444
)
{
{
sys
->
chroma
=
VDP_CHROMA_TYPE_444
;
sys
->
chroma
=
VDP_CHROMA_TYPE_444
;
sys
->
format
=
VDP_YCBCR_FORMAT_NV12
;
sys
->
format
=
VDP_YCBCR_FORMAT_NV12
;
filter
->
pf_video_filter
=
VideoRender
;
}
}
else
else
if
(
filter
->
fmt_in
.
video
.
i_chroma
==
VLC_CODEC_VDPAU_VIDEO_422
)
if
(
filter
->
fmt_in
.
video
.
i_chroma
==
VLC_CODEC_VDPAU_VIDEO_422
)
...
@@ -714,23 +678,37 @@ static int OutputOpen(vlc_object_t *obj)
...
@@ -714,23 +678,37 @@ static int OutputOpen(vlc_object_t *obj)
sys
->
chroma
=
VDP_CHROMA_TYPE_422
;
sys
->
chroma
=
VDP_CHROMA_TYPE_422
;
/* TODO: check if the drivery supports NV12 or UYVY */
/* TODO: check if the drivery supports NV12 or UYVY */
sys
->
format
=
VDP_YCBCR_FORMAT_UYVY
;
sys
->
format
=
VDP_YCBCR_FORMAT_UYVY
;
filter
->
pf_video_filter
=
VideoRender
;
}
}
else
else
if
(
filter
->
fmt_in
.
video
.
i_chroma
==
VLC_CODEC_VDPAU_VIDEO_420
)
if
(
filter
->
fmt_in
.
video
.
i_chroma
==
VLC_CODEC_VDPAU_VIDEO_420
)
{
{
sys
->
chroma
=
VDP_CHROMA_TYPE_420
;
sys
->
chroma
=
VDP_CHROMA_TYPE_420
;
sys
->
format
=
VDP_YCBCR_FORMAT_NV12
;
sys
->
format
=
VDP_YCBCR_FORMAT_NV12
;
filter
->
pf_video_filter
=
VideoRender
;
}
}
else
else
if
(
vlc_fourcc_to_vdp_ycc
(
filter
->
fmt_in
.
video
.
i_chroma
,
if
(
vlc_fourcc_to_vdp_ycc
(
filter
->
fmt_in
.
video
.
i_chroma
,
&
sys
->
chroma
,
&
sys
->
format
))
&
sys
->
chroma
,
&
sys
->
format
))
filter
->
pf_
video_filter
=
YCbCrRender
;
video_filter
=
YCbCrRender
;
else
else
goto
error
;
/* Get the context and allocate the mixer (through *ahem* picture) */
picture_t
*
pic
=
filter_NewPicture
(
filter
);
if
(
pic
==
NULL
)
goto
error
;
picture_sys_t
*
picsys
=
pic
->
p_sys
;
assert
(
picsys
!=
NULL
&&
picsys
->
vdp
!=
NULL
);
sys
->
vdp
=
vdp_hold_x11
(
picsys
->
vdp
,
NULL
);
sys
->
device
=
picsys
->
device
;
picture_Release
(
pic
);
sys
->
mixer
=
MixerCreate
(
filter
);
if
(
sys
->
mixer
==
VDP_INVALID_HANDLE
)
{
{
free
(
sys
);
vdp_release_x11
(
sys
->
vdp
);
return
VLC_EGENERIC
;
goto
error
;
}
}
/* NOTE: The video mixer capabilities should be checked here, and the
/* NOTE: The video mixer capabilities should be checked here, and the
...
@@ -748,9 +726,12 @@ static int OutputOpen(vlc_object_t *obj)
...
@@ -748,9 +726,12 @@ static int OutputOpen(vlc_object_t *obj)
sys
->
procamp
.
saturation
=
1
.
f
;
sys
->
procamp
.
saturation
=
1
.
f
;
sys
->
procamp
.
hue
=
0
.
f
;
sys
->
procamp
.
hue
=
0
.
f
;
filter
->
pf_video_filter
=
video_filter
;
filter
->
pf_video_flush
=
Flush
;
filter
->
pf_video_flush
=
Flush
;
filter
->
p_sys
=
sys
;
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
error:
free
(
sys
);
return
VLC_EGENERIC
;
}
}
static
void
OutputClose
(
vlc_object_t
*
obj
)
static
void
OutputClose
(
vlc_object_t
*
obj
)
...
@@ -759,11 +740,8 @@ static void OutputClose(vlc_object_t *obj)
...
@@ -759,11 +740,8 @@ static void OutputClose(vlc_object_t *obj)
filter_sys_t
*
sys
=
filter
->
p_sys
;
filter_sys_t
*
sys
=
filter
->
p_sys
;
Flush
(
filter
);
Flush
(
filter
);
if
(
sys
->
mixer
!=
VDP_INVALID_HANDLE
)
vdp_video_mixer_destroy
(
sys
->
vdp
,
sys
->
mixer
);
{
vdp_release_x11
(
sys
->
vdp
);
vdp_video_mixer_destroy
(
sys
->
vdp
,
sys
->
mixer
);
vdp_release_x11
(
sys
->
vdp
);
}
free
(
sys
);
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