Skip to content

Commit

Permalink
avcodec: va: respect the buffer release prototype
Browse files Browse the repository at this point in the history
It has always have an extra uint8_t pointer.

--
replaces https://patches.videolan.org/patch/15166/
fix compilation

Signed-off-by: Rémi Denis-Courmont <[email protected]>
  • Loading branch information
robUx4 authored and Rémi Denis-Courmont committed Nov 29, 2016
1 parent 89c7023 commit ac1f5fe
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion modules/codec/avcodec/directx_va.c
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ int directx_va_Get(vlc_va_t *va, directx_sys_t *dx_sys, picture_t *pic, uint8_t
return VLC_SUCCESS;
}

void directx_va_Release(void *opaque)
void directx_va_Release(void *opaque, uint8_t *data)
{
picture_t *pic = opaque;
vlc_va_surface_t *surface = pic->context;
Expand Down
2 changes: 1 addition & 1 deletion modules/codec/avcodec/directx_va.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ int directx_va_Open(vlc_va_t *, directx_sys_t *, AVCodecContext *ctx, const es_f
void directx_va_Close(vlc_va_t *, directx_sys_t *);
int directx_va_Setup(vlc_va_t *, directx_sys_t *, AVCodecContext *avctx);
int directx_va_Get(vlc_va_t *, directx_sys_t *, picture_t *pic, uint8_t **data);
void directx_va_Release(void *opaque);
void directx_va_Release(void *opaque, uint8_t *data);
char *directx_va_GetDecoderName(const GUID *guid);

#endif /* AVCODEC_DIRECTX_VA_H */
4 changes: 2 additions & 2 deletions modules/codec/avcodec/va.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct vlc_va_t {
void (*setup)(vlc_va_t *, vlc_fourcc_t *output);
#endif
int (*get)(vlc_va_t *, picture_t *pic, uint8_t **data);
void (*release)(void *pic);
void (*release)(void *pic, uint8_t *data);
int (*extract)(vlc_va_t *, picture_t *pic, uint8_t *data);
};

Expand Down Expand Up @@ -95,7 +95,7 @@ static inline int vlc_va_Get(vlc_va_t *va, picture_t *pic, uint8_t **data)
*/
static inline void vlc_va_Release(vlc_va_t *va, picture_t *pic)
{
va->release(pic);
va->release(pic, NULL);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion modules/codec/avcodec/vaapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,9 @@ static int Get( vlc_va_t *va, picture_t *pic, uint8_t **data )
return VLC_SUCCESS;
}

static void Release( void *opaque )
static void Release( void *opaque, uint8_t *data )
{
(void) data;
picture_t *pic = opaque;
VASurfaceID *surface = pic->context;
vlc_va_sys_t *sys = (void *)((((uintptr_t)surface)
Expand Down
3 changes: 2 additions & 1 deletion modules/codec/avcodec/vda.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ static int Get( vlc_va_t *va, picture_t *p_picture, uint8_t **data )
}

// Never called
static void Release( void *opaque )
static void Release( void *opaque, uint8_t *data )
{
VLC_UNUSED(opaque);
VLC_UNUSED(data);
}

static int Extract( vlc_va_t *va, picture_t *p_picture, uint8_t *data )
Expand Down
7 changes: 4 additions & 3 deletions modules/codec/avcodec/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1106,8 +1106,9 @@ static void ffmpeg_InitCodec( decoder_t *p_dec )
}
}

static void lavc_ReleaseFrame(void *opaque)
static void lavc_ReleaseFrame(void *opaque, uint8_t *data)
{
(void) data;
picture_t *picture = opaque;

picture_Release(picture);
Expand All @@ -1129,14 +1130,14 @@ static int lavc_va_GetFrame(struct AVCodecContext *ctx, AVFrame *frame,
* data[3] actually contains the format-specific surface handle. */
frame->data[3] = frame->data[0];

void (*release)(void *) = va->release;
void (*release)(void *, uint8_t *) = va->release;
if (va->release == NULL)
release = lavc_ReleaseFrame;

frame->buf[0] = av_buffer_create(frame->data[0], 0, release, pic, 0);
if (unlikely(frame->buf[0] == NULL))
{
release(pic);
release(pic, frame->data[0]);
return -1;
}

Expand Down

0 comments on commit ac1f5fe

Please sign in to comment.