]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/utils.c
Merge commit 'e36a2f4c5280e2779b0e88974295a711cf8d88be'
[ffmpeg] / libavformat / utils.c
index 3afe488f105b6992e9532791edf75aed44228afb..9404118b96b2f7bce66c3386db9295d9a81ea801 100644 (file)
@@ -115,6 +115,11 @@ int64_t av_stream_get_end_pts(const AVStream *st)
     return st->pts.val;
 }
 
+struct AVCodecParserContext *av_stream_get_parser(const AVStream *st)
+{
+    return st->parser;
+}
+
 void av_format_inject_global_side_data(AVFormatContext *s)
 {
     int i;
@@ -1634,7 +1639,8 @@ int av_read_frame(AVFormatContext *s, AVPacket *pkt)
             }
 
             /* read packet from packet buffer, if there is data */
-            if (!(next_pkt->pts == AV_NOPTS_VALUE &&
+            st = s->streams[next_pkt->stream_index];
+            if (!(next_pkt->pts == AV_NOPTS_VALUE && st->discard < AVDISCARD_ALL &&
                   next_pkt->dts != AV_NOPTS_VALUE && !eof)) {
                 ret = read_from_packet_buffer(&s->packet_buffer,
                                                &s->packet_buffer_end, pkt);
@@ -3111,6 +3117,8 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
     if (!max_analyze_duration)
         max_analyze_duration = ic->max_analyze_duration;
 
+    av_opt_set(ic, "skip_clear", "1", AV_OPT_SEARCH_CHILDREN);
+
     if (!max_analyze_duration) {
         if (!strcmp(ic->iformat->name, "flv") && !(ic->ctx_flags & AVFMTCTX_NOHEADER)) {
             max_analyze_duration = 10*AV_TIME_BASE;
@@ -3396,6 +3404,7 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
             }
         }
     }
+    av_opt_set(ic, "skip_clear", "0", AV_OPT_SEARCH_CHILDREN);
 
     // close codecs which were opened in try_decode_frame()
     for (i = 0; i < ic->nb_streams; i++) {
@@ -4162,7 +4171,7 @@ int64_t ff_iso8601_to_unix_time(const char *datestr)
         return av_timegm(&time1);
 }
 
-int avformat_query_codec(AVOutputFormat *ofmt, enum AVCodecID codec_id,
+int avformat_query_codec(const AVOutputFormat *ofmt, enum AVCodecID codec_id,
                          int std_compliance)
 {
     if (ofmt) {