[vlc-devel] [PATCH] picture: copy picture context in picture_Copy() (fixes #14456)
Steve Lhomme
robux4 at gmail.com
Tue Jun 6 08:53:51 CEST 2017
On Mon, Jun 5, 2017 at 8:10 PM, Thomas Guillem <thomas at gllm.fr> wrote:
>
> On Mon, Jun 5, 2017, at 19:59, RĂ©mi Denis-Courmont wrote:
>> ---
>> include/vlc_picture.h | 1 +
>> modules/hw/vdpau/picture.c | 4 ++--
>> modules/hw/vdpau/vlc_vdpau.h | 3 +--
>
> hw/vdpau changes should be in a separated patch.
>
>> src/misc/picture.c | 5 +++++
>> 4 files changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/include/vlc_picture.h b/include/vlc_picture.h
>> index a48a053ac6..e25374634f 100644
>> --- a/include/vlc_picture.h
>> +++ b/include/vlc_picture.h
>> @@ -59,6 +59,7 @@ typedef struct plane_t
>> typedef struct picture_context_t
>> {
>> void (*destroy)(struct picture_context_t *);
>> + struct picture_context_t *(*copy)(struct picture_context_t *);
>> } picture_context_t;
>>
>> /**
>> diff --git a/modules/hw/vdpau/picture.c b/modules/hw/vdpau/picture.c
>> index 88801167a5..4c42eef719 100644
>> --- a/modules/hw/vdpau/picture.c
>> +++ b/modules/hw/vdpau/picture.c
>> @@ -65,7 +65,7 @@ static picture_context_t *SurfaceCopy(picture_context_t
>> *ctx)
>> return NULL;
>>
>> fnew->context.destroy = SurfaceDestroy;
>> - fnew->copy = SurfaceCopy;
>> + fnew->context.copy = SurfaceCopy;
>> fnew->frame = frame;
>> fnew->structure = fold->structure;
>> fnew->procamp = fold->procamp;
>> @@ -98,7 +98,7 @@ vlc_vdp_video_field_t *vlc_vdp_video_create(vdp_t *vdp,
>> }
>>
>> field->context.destroy = SurfaceDestroy;
>> - field->copy = SurfaceCopy;
>> + field->context.copy = SurfaceCopy;
>> field->frame = frame;
>> field->structure = VDP_VIDEO_MIXER_PICTURE_STRUCTURE_FRAME;
>> field->procamp = procamp_default;
>> diff --git a/modules/hw/vdpau/vlc_vdpau.h b/modules/hw/vdpau/vlc_vdpau.h
>> index 318425c79b..af62bddcc1 100644
>> --- a/modules/hw/vdpau/vlc_vdpau.h
>> +++ b/modules/hw/vdpau/vlc_vdpau.h
>> @@ -274,7 +274,6 @@ typedef struct vlc_vdp_video_frame
>> typedef struct vlc_vdp_video_field
>> {
>> picture_context_t context;
>> - struct picture_context_t *(*copy)(struct picture_context_t *);
>> vlc_vdp_video_frame_t *frame;
>> VdpVideoMixerPictureStructure structure;
>> VdpProcamp procamp;
>> @@ -303,6 +302,6 @@ static inline void
>> vlc_vdp_video_destroy(vlc_vdp_video_field_t *f)
>> static inline vlc_vdp_video_field_t *vlc_vdp_video_copy(
>> vlc_vdp_video_field_t *fold)
>> {
>> - return (vlc_vdp_video_field_t *)fold->copy(&fold->context);
>> + return (vlc_vdp_video_field_t *)fold->context.copy(&fold->context);
>> }
>> #endif
>> diff --git a/src/misc/picture.c b/src/misc/picture.c
>> index 3f37648985..0cb251255b 100644
>> --- a/src/misc/picture.c
>> +++ b/src/misc/picture.c
>> @@ -368,6 +368,11 @@ void picture_CopyPixels( picture_t *p_dst, const
>> picture_t *p_src )
>> {
>> for( int i = 0; i < p_src->i_planes ; i++ )
>> plane_CopyPixels( p_dst->p+i, p_src->p+i );
>> +
>> + assert( p_dst->context == NULL );
>> +
>> + if( p_src->context != NULL )
>> + p_dst->context = p_src->context->copy( p_src->context );
>> }
>>
>
> This looks good, but can you wait a little in order to make sure that we
> can implement it on CVPX/VAAPI/D3D*
Luckily dxva is only using picture->context locally so it's not broken
by this patch.
>> void picture_Copy( picture_t *p_dst, const picture_t *p_src )
>> --
>> 2.11.0
>>
>> _______________________________________________
>> vlc-devel mailing list
>> To unsubscribe or modify your subscription options:
>> https://mailman.videolan.org/listinfo/vlc-devel
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
More information about the vlc-devel
mailing list