]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/bintext.c
lavc: Check CODEC_CAP_VARIABLE_FRAME_SIZE && !frame
[ffmpeg] / libavcodec / bintext.c
index 947be396b84c4b874ef421e4d904486325708c65..91167ba150bce5f71e5e23d524f4819c9e5e190a 100644 (file)
@@ -61,7 +61,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     if ((s->flags & BINTEXT_PALETTE)) {
         for (i = 0; i < 16; i++) {
-            s->palette[i] = 0xFF000000 | (AV_RB24(p) << 2);
+            s->palette[i] = 0xFF000000 | (AV_RB24(p) << 2) | ((AV_RB24(p) >> 4) & 0x30303);
             p += 3;
         }
     } else {
@@ -139,7 +139,7 @@ static int decode_frame(AVCodecContext *avctx,
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
         return -1;
     }
-    s->frame.pict_type           = FF_I_TYPE;
+    s->frame.pict_type           = AV_PICTURE_TYPE_I;
     s->frame.palette_has_changed = 1;
     memcpy(s->frame.data[1], s->palette, 16 * 4);
 
@@ -211,40 +211,37 @@ static av_cold int decode_end(AVCodecContext *avctx)
 }
 
 AVCodec ff_bintext_decoder = {
-    "bintext",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_BINTEXT,
-    sizeof(XbinContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
+    .name           = "bintext",
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = CODEC_ID_BINTEXT,
+    .priv_data_size = sizeof(XbinContext),
+    .init           = decode_init,
+    .close          = decode_end,
+    .decode         = decode_frame,
+    .capabilities   = CODEC_CAP_DR1,
     .long_name = NULL_IF_CONFIG_SMALL("Binary text"),
 };
 
 AVCodec ff_xbin_decoder = {
-    "xbin",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_XBIN,
-    sizeof(XbinContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
+    .name           = "xbin",
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = CODEC_ID_XBIN,
+    .priv_data_size = sizeof(XbinContext),
+    .init           = decode_init,
+    .close          = decode_end,
+    .decode         = decode_frame,
+    .capabilities   = CODEC_CAP_DR1,
     .long_name = NULL_IF_CONFIG_SMALL("eXtended BINary text"),
 };
 
 AVCodec ff_idf_decoder = {
-    "idf",
-    AVMEDIA_TYPE_VIDEO,
-    CODEC_ID_IDF,
-    sizeof(XbinContext),
-    decode_init,
-    NULL,
-    decode_end,
-    decode_frame,
-    CODEC_CAP_DR1,
+    .name           = "idf",
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = CODEC_ID_IDF,
+    .priv_data_size = sizeof(XbinContext),
+    .init           = decode_init,
+    .close          = decode_end,
+    .decode         = decode_frame,
+    .capabilities   = CODEC_CAP_DR1,
     .long_name = NULL_IF_CONFIG_SMALL("iCEDraw text"),
 };