[FFmpeg-devel] [RFC/PATCH 5/8] tidsp: add init/close
Felipe Contreras
felipe.contreras
Mon Sep 6 00:15:32 CEST 2010
Signed-off-by: Felipe Contreras <felipe.contreras at gmail.com>
---
libavcodec/tidsp_mpeg4.c | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/libavcodec/tidsp_mpeg4.c b/libavcodec/tidsp_mpeg4.c
index 3c3190d..1ed2e90 100644
--- a/libavcodec/tidsp_mpeg4.c
+++ b/libavcodec/tidsp_mpeg4.c
@@ -8,8 +8,34 @@
* in the packaging of this file.
*/
+#include "tidsp/tidsp.h"
+
#include "avcodec.h"
+struct td_av_context {
+ struct td_context *td_ctx;
+};
+
+static av_cold int init(AVCodecContext *avctx)
+{
+ struct td_av_context *ctx;
+ struct td_context *td_ctx;
+
+ avctx->hwaccel_private = ctx = av_mallocz(sizeof(*ctx));
+ ctx->td_ctx = td_ctx = td_new(avctx);
+ return 0;
+}
+
+static av_cold int close(AVCodecContext *avctx)
+{
+ struct td_av_context *ctx = avctx->hwaccel_private;
+
+ td_free(ctx->td_ctx);
+ av_freep(&avctx->hwaccel_private);
+
+ return 0;
+}
+
static int start_frame(av_unused AVCodecContext *avctx,
av_unused const uint8_t *buffer,
av_unused uint32_t size)
@@ -37,4 +63,6 @@ AVHWAccel mpeg4_tidsp_hwaccel = {
.start_frame = start_frame,
.end_frame = end_frame,
.decode_slice = decode_slice,
+ .init = init,
+ .close = close,
};
--
1.7.2.2
More information about the ffmpeg-devel
mailing list