One situation where a subtitle packet can be marked for discard is when 
demuxing an MOV file that has an edit list.
---
 libavcodec/decode.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 6c31166ec2..204bd50fa3 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -1149,8 +1149,14 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, 
AVSubtitle *sub,
             }
         }
 
-        if (*got_sub_ptr)
-            avctx->frame_number++;
+        if (*got_sub_ptr) {
+            if (avpkt->flags & AV_PKT_FLAG_DISCARD) {
+                *got_sub_ptr = 0;
+                avsubtitle_free(sub);
+            } else {
+                avctx->frame_number++;
+            }
+        }
     }
 
     return ret;
-- 
2.21.0

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to