Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Steve Lhomme
VLC
Commits
7080c3bb
Commit
7080c3bb
authored
Nov 27, 2016
by
Rémi Denis-Courmont
Browse files
vdpau: add proper structure type for picture context
parent
116df7fa
Changes
9
Hide whitespace changes
Inline
Side-by-side
include/vlc_picture.h
View file @
7080c3bb
...
...
@@ -56,6 +56,11 @@ typedef struct plane_t
*/
#define PICTURE_PLANE_MAX (VOUT_MAX_PLANES)
typedef
struct
picture_context_t
{
void
(
*
destroy
)(
struct
picture_context_t
*
);
}
picture_context_t
;
/**
* Video picture
*/
...
...
@@ -84,8 +89,7 @@ struct picture_t
bool
b_progressive
;
/**< is it a progressive frame ? */
bool
b_top_field_first
;
/**< which field is first */
unsigned
int
i_nb_fields
;
/**< # of displayed fields */
void
*
context
;
/**< video format-specific data pointer,
* must point to a (void (*)(void*)) pointer to free the context */
picture_context_t
*
context
;
/**< video format-specific data pointer */
/**@}*/
/** Private data - the video output plugin might want to put stuff here to
...
...
modules/hw/vdpau/adjust.c
View file @
7080c3bb
...
...
@@ -108,7 +108,7 @@ static int HueCallback(vlc_object_t *obj, const char *varname,
static
picture_t
*
Adjust
(
filter_t
*
filter
,
picture_t
*
pic
)
{
filter_sys_t
*
sys
=
filter
->
p_sys
;
vlc_vdp_video_field_t
*
f
=
pic
->
context
;
vlc_vdp_video_field_t
*
f
=
(
vlc_vdp_video_field_t
*
)
pic
->
context
;
if
(
unlikely
(
f
==
NULL
))
return
pic
;
...
...
modules/hw/vdpau/avcodec.c
View file @
7080c3bb
...
...
@@ -73,7 +73,7 @@ static vlc_vdp_video_field_t *CreateSurface(vlc_va_t *va)
static
void
DestroySurface
(
vlc_vdp_video_field_t
*
field
)
{
assert
(
field
!=
NULL
);
field
->
destroy
(
field
);
field
->
context
.
destroy
(
&
field
->
context
);
}
static
vlc_vdp_video_field_t
*
GetSurface
(
vlc_va_t
*
va
)
...
...
@@ -109,7 +109,7 @@ static int Lock(vlc_va_t *va, picture_t *pic, uint8_t **data)
msleep
(
VOUT_OUTMEM_SLEEP
);
}
pic
->
context
=
field
;
pic
->
context
=
&
field
->
context
;
*
data
=
(
void
*
)(
uintptr_t
)
field
->
frame
->
surface
;
return
VLC_SUCCESS
;
}
...
...
modules/hw/vdpau/chroma.c
View file @
7080c3bb
...
...
@@ -290,7 +290,8 @@ static void Flush(filter_t *filter)
for
(
unsigned
i
=
0
;
i
<
MAX_PAST
+
MAX_FUTURE
;
i
++
)
if
(
sys
->
history
[
i
].
field
!=
NULL
)
{
sys
->
history
[
i
].
field
->
destroy
(
sys
->
history
[
i
].
field
);
sys
->
history
[
i
].
field
->
context
.
destroy
(
&
sys
->
history
[
i
].
field
->
context
);
sys
->
history
[
i
].
field
=
NULL
;
}
}
...
...
@@ -299,7 +300,7 @@ static void Flush(filter_t *filter)
static
picture_t
*
VideoExport
(
filter_t
*
filter
,
picture_t
*
src
,
picture_t
*
dst
)
{
filter_sys_t
*
sys
=
filter
->
p_sys
;
vlc_vdp_video_field_t
*
field
=
src
->
context
;
vlc_vdp_video_field_t
*
field
=
(
vlc_vdp_video_field_t
*
)
src
->
context
;
vlc_vdp_video_frame_t
*
psys
=
field
->
frame
;
VdpStatus
err
;
VdpVideoSurface
surface
=
psys
->
surface
;
...
...
@@ -446,7 +447,7 @@ static picture_t *Render(filter_t *filter, picture_t *src, bool import)
}
/* Corner case: different VDPAU instances decoding and rendering */
vlc_vdp_video_field_t
*
field
=
src
->
context
;
vlc_vdp_video_field_t
*
field
=
(
vlc_vdp_video_field_t
*
)
src
->
context
;
if
(
field
->
frame
->
vdp
!=
sys
->
vdp
)
{
video_format_t
fmt
=
src
->
format
;
...
...
@@ -478,7 +479,7 @@ static picture_t *Render(filter_t *filter, picture_t *src, bool import)
if
(
likely
(
src
!=
NULL
))
{
sys
->
history
[
MAX_PAST
+
MAX_FUTURE
].
field
=
vlc_vdp_video_copy
(
src
->
context
);
vlc_vdp_video_copy
(
(
vlc_vdp_video_field_t
*
)
src
->
context
);
sys
->
history
[
MAX_PAST
+
MAX_FUTURE
].
date
=
src
->
date
;
sys
->
history
[
MAX_PAST
+
MAX_FUTURE
].
force
=
src
->
b_force
;
picture_Release
(
src
);
...
...
@@ -502,7 +503,7 @@ static picture_t *Render(filter_t *filter, picture_t *src, bool import)
{
f
=
sys
->
history
[
0
].
field
;
if
(
f
!=
NULL
)
f
->
destroy
(
f
);
f
->
context
.
destroy
(
&
f
->
context
);
memmove
(
sys
->
history
,
sys
->
history
+
1
,
sizeof
(
sys
->
history
[
0
])
*
(
MAX_PAST
+
MAX_FUTURE
));
...
...
@@ -679,7 +680,7 @@ static picture_t *Render(filter_t *filter, picture_t *src, bool import)
skip:
f
=
sys
->
history
[
0
].
field
;
if
(
f
!=
NULL
)
f
->
destroy
(
f
);
/* Release oldest field */
f
->
context
.
destroy
(
&
f
->
context
);
/* Release oldest field */
memmove
(
sys
->
history
,
sys
->
history
+
1
,
/* Advance history */
sizeof
(
sys
->
history
[
0
])
*
(
MAX_PAST
+
MAX_FUTURE
));
...
...
modules/hw/vdpau/deinterlace.c
View file @
7080c3bb
...
...
@@ -43,7 +43,7 @@ static picture_t *Deinterlace(filter_t *filter, picture_t *src)
sys
->
last_pts
=
src
->
date
;
vlc_vdp_video_field_t
*
f1
=
src
->
context
;
vlc_vdp_video_field_t
*
f1
=
(
vlc_vdp_video_field_t
*
)
src
->
context
;
if
(
unlikely
(
f1
==
NULL
))
return
src
;
if
(
f1
->
structure
!=
VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME
)
...
...
@@ -65,7 +65,7 @@ static picture_t *Deinterlace(filter_t *filter, picture_t *src)
}
picture_CopyProperties
(
dst
,
src
);
dst
->
context
=
f2
;
dst
->
context
=
&
f2
->
context
;
if
(
last_pts
!=
VLC_TS_INVALID
)
dst
->
date
=
(
3
*
src
->
date
-
last_pts
)
/
2
;
...
...
modules/hw/vdpau/picture.c
View file @
7080c3bb
...
...
@@ -32,9 +32,12 @@
#pragma GCC visibility push(default)
static
void
SurfaceDestroy
(
void
*
opaque
)
static_assert
(
offsetof
(
vlc_vdp_video_field_t
,
context
)
==
0
,
"Cast assumption failure"
);
static
void
SurfaceDestroy
(
struct
picture_context_t
*
ctx
)
{
vlc_vdp_video_field_t
*
field
=
opaque
;
vlc_vdp_video_field_t
*
field
=
(
vlc_vdp_video_field_t
*
)
ctx
;
vlc_vdp_video_frame_t
*
frame
=
field
->
frame
;
VdpStatus
err
;
...
...
@@ -75,7 +78,7 @@ vlc_vdp_video_field_t *vlc_vdp_video_create(vdp_t *vdp,
return
NULL
;
}
field
->
destroy
=
SurfaceDestroy
;
field
->
context
.
destroy
=
SurfaceDestroy
;
field
->
frame
=
frame
;
field
->
structure
=
VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME
;
field
->
procamp
=
procamp_default
;
...
...
@@ -99,7 +102,7 @@ VdpStatus vlc_vdp_video_attach(vdp_t *vdp, VdpVideoSurface surface,
||
pic
->
format
.
i_chroma
==
VLC_CODEC_VDPAU_VIDEO_444
);
assert
(
!
picture_IsReferenced
(
pic
));
assert
(
pic
->
context
==
NULL
);
pic
->
context
=
field
;
pic
->
context
=
&
field
->
context
;
return
VDP_STATUS_OK
;
}
...
...
@@ -110,7 +113,7 @@ vlc_vdp_video_field_t *vlc_vdp_video_copy(vlc_vdp_video_field_t *fold)
if
(
unlikely
(
fnew
==
NULL
))
return
NULL
;
fnew
->
destroy
=
SurfaceDestroy
;
fnew
->
context
.
destroy
=
SurfaceDestroy
;
fnew
->
frame
=
frame
;
fnew
->
structure
=
fold
->
structure
;
fnew
->
procamp
=
fold
->
procamp
;
...
...
modules/hw/vdpau/sharpen.c
View file @
7080c3bb
...
...
@@ -61,7 +61,7 @@ static int SharpenCallback(vlc_object_t *obj, const char *varname,
static
picture_t
*
Sharpen
(
filter_t
*
filter
,
picture_t
*
pic
)
{
filter_sys_t
*
sys
=
filter
->
p_sys
;
vlc_vdp_video_field_t
*
f
=
pic
->
context
;
vlc_vdp_video_field_t
*
f
=
(
vlc_vdp_video_field_t
*
)
pic
->
context
;
union
{
uint32_t
u
;
float
f
;
}
u
;
if
(
unlikely
(
f
==
NULL
))
...
...
modules/hw/vdpau/vlc_vdpau.h
View file @
7080c3bb
...
...
@@ -208,6 +208,7 @@ void vdp_release_x11(vdp_t *);
# include <vlc_common.h>
# include <vlc_fourcc.h>
# include <vlc_atomic.h>
# include <vlc_picture.h>
/** Converts VLC YUV format to VDPAU chroma type and YCbCr format */
static
inline
...
...
@@ -272,7 +273,7 @@ typedef struct vlc_vdp_video_frame
typedef
struct
vlc_vdp_video_field
{
void
(
*
destroy
)(
void
*
);
/* must be first @ref picture_Release() */
picture_context_t
context
;
vlc_vdp_video_frame_t
*
frame
;
VdpVideoMixerPictureStructure
structure
;
VdpProcamp
procamp
;
...
...
src/misc/picture.c
View file @
7080c3bb
...
...
@@ -86,11 +86,10 @@ static int AllocatePicture( picture_t *p_pic )
static
void
PictureDestroyContext
(
picture_t
*
p_picture
)
{
void
(
**
context
)(
void
*
)
=
p_picture
->
context
;
if
(
context
!=
NULL
)
picture_context_t
*
ctx
=
p_picture
->
context
;
if
(
ctx
!=
NULL
)
{
void
(
*
context_destroy
)(
void
*
)
=
*
context
;
context_destroy
(
context
);
ctx
->
destroy
(
ctx
);
p_picture
->
context
=
NULL
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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