Will be needed by tidsp.
Signed-off-by: Felipe Contreras <[email protected]>
---
libavcodec/avcodec.h | 3 +++
libavcodec/utils.c | 7 +++++++
2 files changed, 10 insertions(+)
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index d1df5b4..6e7fde0 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2936,6 +2936,9 @@ typedef struct AVHWAccel {
* AVCodecContext.release_buffer().
*/
int priv_data_size;
+
+ int (*init)(AVCodecContext *avctx);
+ int (*close)(AVCodecContext *avctx);
} AVHWAccel;
/**
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index e57f7ef..5f84341 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -811,6 +811,11 @@ int attribute_align_arg avcodec_open2(AVCodecContext
*avctx, AVCodec *codec, AVD
goto free_and_end;
}
}
+ if (avctx->hwaccel && avctx->hwaccel->init) {
+ ret = avctx->hwaccel->init(avctx);
+ if (ret < 0)
+ goto free_and_end;
+ }
end:
entangled_thread_counter--;
@@ -1343,6 +1348,8 @@ av_cold int avcodec_close(AVCodecContext *avctx)
if (avcodec_is_open(avctx)) {
if (HAVE_THREADS && avctx->thread_opaque)
ff_thread_free(avctx);
+ if (avctx->hwaccel && avctx->hwaccel->close)
+ avctx->hwaccel->close(avctx);
if (avctx->codec && avctx->codec->close)
avctx->codec->close(avctx);
avcodec_default_free_buffers(avctx);
--
1.7.9.2
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel