X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavformat%2Favidec.c;h=b8a31dcff28755afab071ce811ecb46b85c9d80c;hb=e00e8639b22a06b77ada2b906a4b1ccdb373adc1;hp=4e694fe447fd0bccbf2779551d530f1efa2f8e5e;hpb=42ed79a2294ca08e3902bd92003d4ccd9cf464ef;p=ffmpeg diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 4e694fe447f..b8a31dcff28 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -727,7 +727,8 @@ FF_ENABLE_DEPRECATION_WARNINGS break; case MKTAG('s', 't', 'r', 'f'): /* stream header */ - if (!size) + if (!size && (codec_type == AVMEDIA_TYPE_AUDIO || + codec_type == AVMEDIA_TYPE_VIDEO)) break; if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) { avio_skip(pb, size); @@ -1098,6 +1099,9 @@ static int read_gab2_sub(AVFormatContext *s, AVStream *st, AVPacket *pkt) if (!sub_demuxer) goto error; + if (strcmp(sub_demuxer->name, "srt") && strcmp(sub_demuxer->name, "ass")) + goto error; + if (!(ast->sub_ctx = avformat_alloc_context())) goto error; @@ -1120,7 +1124,7 @@ static int read_gab2_sub(AVFormatContext *s, AVStream *st, AVPacket *pkt) error: av_freep(&ast->sub_ctx); - av_freep(&pb); + avio_context_free(&pb); } return 0; } @@ -1261,19 +1265,6 @@ start_sync: } } - if (!avi->dv_demux && - ((st->discard >= AVDISCARD_DEFAULT && size == 0) /* || - // FIXME: needs a little reordering - (st->discard >= AVDISCARD_NONKEY && - !(pkt->flags & AV_PKT_FLAG_KEY)) */ - || st->discard >= AVDISCARD_ALL)) { - if (!exit_early) { - ast->frame_offset += get_duration(ast, size); - avio_skip(pb, size); - goto start_sync; - } - } - if (d[2] == 'p' && d[3] == 'c' && size <= 4 * 256 + 4) { int k = avio_r8(pb); int last = (k + avio_r8(pb) - 1) & 0xFF; @@ -1300,6 +1291,18 @@ start_sync: ast->prefix_count = 0; } + if (!avi->dv_demux && + ((st->discard >= AVDISCARD_DEFAULT && size == 0) /* || + // FIXME: needs a little reordering + (st->discard >= AVDISCARD_NONKEY && + !(pkt->flags & AV_PKT_FLAG_KEY)) */ + || st->discard >= AVDISCARD_ALL)) { + + ast->frame_offset += get_duration(ast, size); + avio_skip(pb, size); + goto start_sync; + } + avi->stream_index = n; ast->packet_size = size + 8; ast->remaining = size;