[FFmpeg-devel] [PATCH] Fix for ticket 6796 (ffprobe show_frames ts dvbsubs infinate loop)

Colin NG colin_ng at hotmail.com
Sat Dec 2 02:42:22 EET 2017


---
 fftools/ffprobe.c      |  2 ++
 libavcodec/dvbsubdec.c | 10 +++++-----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index 0e7a771..6ddd81e 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -2280,6 +2280,7 @@ static av_always_inline int process_frame(WriterContext *w,
             break;
         default:
             *packet_new = 0;
+            break;
         }
     } else {
         *packet_new = 0;
@@ -2290,6 +2291,7 @@ static av_always_inline int process_frame(WriterContext *w,
     if (got_frame) {
         int is_sub = (par->codec_type == AVMEDIA_TYPE_SUBTITLE);
         nb_streams_frames[pkt->stream_index]++;
+        got_frame = (par->codec_type == AVMEDIA_TYPE_SUBTITLE) ? 0: got_frame;
         if (do_show_frames)
             if (is_sub)
                 show_subtitle(w, &sub, ifile->streams[pkt->stream_index].st, fmt_ctx);
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index a657b1d..29997a2 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -1596,7 +1596,7 @@ static int dvbsub_display_end_segment(AVCodecContext *avctx, const uint8_t *buf,
 }
 
 static int dvbsub_decode(AVCodecContext *avctx,
-                         void *data, int *data_size,
+                         void *data, int *got_output,
                          AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
@@ -1654,7 +1654,7 @@ static int dvbsub_decode(AVCodecContext *avctx,
             int ret = 0;
             switch (segment_type) {
             case DVBSUB_PAGE_SEGMENT:
-                ret = dvbsub_parse_page_segment(avctx, p, segment_length, sub, data_size);
+                ret = dvbsub_parse_page_segment(avctx, p, segment_length, sub, got_output);
                 got_segment |= 1;
                 break;
             case DVBSUB_REGION_SEGMENT:
@@ -1676,7 +1676,7 @@ static int dvbsub_decode(AVCodecContext *avctx,
                 got_dds = 1;
                 break;
             case DVBSUB_DISPLAY_SEGMENT:
-                ret = dvbsub_display_end_segment(avctx, p, segment_length, sub, data_size);
+                ret = dvbsub_display_end_segment(avctx, p, segment_length, sub, got_output);
                 if (got_segment == 15 && !got_dds && !avctx->width && !avctx->height) {
                     // Default from ETSI EN 300 743 V1.3.1 (7.2.1)
                     avctx->width  = 720;
@@ -1699,12 +1699,12 @@ static int dvbsub_decode(AVCodecContext *avctx,
     // segments then we need no further data.
     if (got_segment == 15) {
         av_log(avctx, AV_LOG_DEBUG, "Missing display_end_segment, emulating\n");
-        dvbsub_display_end_segment(avctx, p, 0, sub, data_size);
+        dvbsub_display_end_segment(avctx, p, 0, sub, got_output);
     }
 
 end:
     if(ret < 0) {
-        *data_size = 0;
+        *got_output = 0;
         avsubtitle_free(sub);
         return ret;
     } else {
-- 
2.7.4



More information about the ffmpeg-devel mailing list