]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/tscc.c
avformat/audiointerleave: only keep the retime functionality of the audio interleaver
[ffmpeg] / libavcodec / tscc.c
index fc9510451b08b671343e6ad13835aa6809564d63..6d03081bb0a3bdca8de2af076ba999bd646c67c0 100644 (file)
@@ -94,12 +94,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
     c->zstream.avail_out = c->decomp_size;
     ret = inflate(&c->zstream, Z_FINISH);
     // Z_DATA_ERROR means empty picture
+    if (ret == Z_DATA_ERROR && !palette_has_changed) {
+        return buf_size;
+    }
+
     if ((ret != Z_OK) && (ret != Z_STREAM_END) && (ret != Z_DATA_ERROR)) {
         av_log(avctx, AV_LOG_ERROR, "Inflate error: %d\n", ret);
         return AVERROR_UNKNOWN;
     }
 
-    if ((ret = ff_reget_buffer(avctx, frame)) < 0)
+    if ((ret = ff_reget_buffer(avctx, frame, 0)) < 0)
         return ret;
 
     if (ret != Z_DATA_ERROR) {
@@ -165,6 +169,8 @@ static av_cold int decode_init(AVCodecContext *avctx)
     }
 
     c->frame = av_frame_alloc();
+    if (!c->frame)
+        return AVERROR(ENOMEM);
 
     return 0;
 }
@@ -191,4 +197,5 @@ AVCodec ff_tscc_decoder = {
     .close          = decode_end,
     .decode         = decode_frame,
     .capabilities   = AV_CODEC_CAP_DR1,
+    .caps_internal  = FF_CODEC_CAP_INIT_CLEANUP,
 };