OSDN Git Service

tmv decoder: set correct pix_fmt
authorUoti Urpala <uoti.urpala@pp1.inet.fi>
Sun, 18 Dec 2011 14:17:07 +0000 (16:17 +0200)
committerRonald S. Bultje <rsbultje@gmail.com>
Sun, 18 Dec 2011 14:58:03 +0000 (06:58 -0800)
Previously the decoder only worked if the user had set avctx->pix_fmt
manually. For some reason the libavformat tmv demuxer sets this, so
the problem was not visible in avplay etc.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
libavcodec/tmv.c

index 870f571..be809b3 100644 (file)
@@ -82,6 +82,12 @@ static int tmv_decode_frame(AVCodecContext *avctx, void *data,
     return avpkt->size;
 }
 
+static av_cold int tmv_decode_init(AVCodecContext *avctx)
+{
+    avctx->pix_fmt = PIX_FMT_PAL8;
+    return 0;
+}
+
 static av_cold int tmv_decode_close(AVCodecContext *avctx)
 {
     TMVContext *tmv = avctx->priv_data;
@@ -97,6 +103,7 @@ AVCodec ff_tmv_decoder = {
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = CODEC_ID_TMV,
     .priv_data_size = sizeof(TMVContext),
+    .init           = tmv_decode_init,
     .close          = tmv_decode_close,
     .decode         = tmv_decode_frame,
     .capabilities   = CODEC_CAP_DR1,