vlc | branch: master | Steve Lhomme <[email protected]> | Wed Oct 23 11:51:35 2019 +0200| [a83cc8d84a8789dd99abc44aa306d6e60a21a34b] | committer: Steve Lhomme
avcodec: va: don't allocate pictures in the VA In the end each VA module just needs to set the picture_context_t on the outgoing picture. It doesn't need to allocate the picture itself for now. The picture_context_t has destroy and copy callbacks which allow for refcounting and detroying the resources when really not needed anymore. Effectively reverts 2e4cd8756db3b396ddedbd7d622ebd67122a34e0. > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a83cc8d84a8789dd99abc44aa306d6e60a21a34b --- modules/codec/avcodec/d3d11va.c | 2 +- modules/codec/avcodec/dxva2.c | 2 +- modules/codec/avcodec/va.h | 11 ----------- modules/codec/avcodec/vaapi.c | 2 +- modules/codec/avcodec/video.c | 4 +--- modules/hw/vdpau/avcodec.c | 2 +- 6 files changed, 5 insertions(+), 18 deletions(-) diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c index a157c4c1e1..70fc90f1f4 100644 --- a/modules/codec/avcodec/d3d11va.c +++ b/modules/codec/avcodec/d3d11va.c @@ -247,7 +247,7 @@ static void Close(vlc_va_t *va) va_pool_Close(sys->va_pool); } -static const struct vlc_va_operations ops = { Get, NULL, Close, }; +static const struct vlc_va_operations ops = { Get, Close, }; static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *desc, enum PixelFormat pix_fmt, diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c index aa9a8abf31..6e661a0707 100644 --- a/modules/codec/avcodec/dxva2.c +++ b/modules/codec/avcodec/dxva2.c @@ -245,7 +245,7 @@ static void Close(vlc_va_t *va) va_pool_Close(sys->va_pool); } -static const struct vlc_va_operations ops = { Get, NULL, Close, }; +static const struct vlc_va_operations ops = { Get, Close, }; static int Open(vlc_va_t *va, AVCodecContext *ctx, const AVPixFmtDescriptor *desc, enum PixelFormat pix_fmt, diff --git a/modules/codec/avcodec/va.h b/modules/codec/avcodec/va.h index d139d608b8..b10cab7e0b 100644 --- a/modules/codec/avcodec/va.h +++ b/modules/codec/avcodec/va.h @@ -33,7 +33,6 @@ typedef struct vlc_video_context vlc_video_context; struct vlc_va_operations { int (*get)(vlc_va_t *, picture_t *pic, uint8_t **surface); - picture_t *(*get_picture)(vlc_va_t *, const video_format_t *); void (*close)(vlc_va_t *); }; @@ -98,16 +97,6 @@ static inline int vlc_va_Get(vlc_va_t *va, picture_t *pic, uint8_t **surface) return va->ops->get(va, pic, surface); } -/** - * Can be called from any thread - */ -static inline picture_t *vlc_va_GetPicture(vlc_va_t *va, const video_format_t *fmt) -{ - if (va->ops->get_picture) - return va->ops->get_picture(va, fmt); - return NULL; -} - /** * Destroys a libavcodec hardware acceleration back-end. * All allocated surfaces shall have been released beforehand. diff --git a/modules/codec/avcodec/vaapi.c b/modules/codec/avcodec/vaapi.c index 0c12d19020..c0049c814e 100644 --- a/modules/codec/avcodec/vaapi.c +++ b/modules/codec/avcodec/vaapi.c @@ -182,7 +182,7 @@ static void Delete(vlc_va_t *va) va_pool_Close(sys->va_pool); } -static const struct vlc_va_operations ops = { Get, NULL, Delete, }; +static const struct vlc_va_operations ops = { Get, Delete, }; static int VAAPICreateDevice(vlc_va_t *va) { diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c index d1d331800e..a6aff92788 100644 --- a/modules/codec/avcodec/video.c +++ b/modules/codec/avcodec/video.c @@ -1472,9 +1472,7 @@ static int lavc_va_GetFrame(struct AVCodecContext *ctx, AVFrame *frame) vlc_va_t *va = p_sys->p_va; picture_t *pic; - pic = vlc_va_GetPicture(va, &dec->fmt_out.video); - if (pic == NULL) - pic = decoder_NewPicture(dec); + pic = decoder_NewPicture(dec); if (pic == NULL) return -1; diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c index 24c79d1020..3c43fcd74a 100644 --- a/modules/hw/vdpau/avcodec.c +++ b/modules/hw/vdpau/avcodec.c @@ -133,7 +133,7 @@ static void Close(vlc_va_t *va) free(sys); } -static const struct vlc_va_operations ops = { Lock, NULL, Close, }; +static const struct vlc_va_operations ops = { Lock, Close, }; static int Open(vlc_va_t *va, AVCodecContext *avctx, const AVPixFmtDescriptor *desc, enum PixelFormat pix_fmt, _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
