]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/utils.c
avfilter/showspectrum: add blackman window.
[ffmpeg] / libavformat / utils.c
index 5637d17cba386006e77eafad4402deb013bba911..9522909bfcb0441cadb9ef5c2e9bfd8acc5b870b 100644 (file)
@@ -399,6 +399,11 @@ int av_probe_input_buffer2(AVIOContext *pb, AVInputFormat **fmt,
                 av_log(logctx, AV_LOG_WARNING, "Format %s detected only with low score of %d, misdetection possible!\n", (*fmt)->name, score);
             }else
                 av_log(logctx, AV_LOG_DEBUG, "Format %s probed with size=%d and score=%d\n", (*fmt)->name, probe_size, score);
+#if 0
+            FILE *f = fopen("probestat.tmp", "ab");
+            fprintf(f, "probe_size:%d format:%s score:%d filename:%s\n", probe_size, (*fmt)->name, score, filename);
+            fclose(f);
+#endif
         }
     }
 
@@ -2443,7 +2448,7 @@ static int try_decode_frame(AVFormatContext *s, AVStream *st, AVPacket *avpkt, A
 {
     const AVCodec *codec;
     int got_picture = 1, ret = 0;
-    AVFrame *frame = avcodec_alloc_frame();
+    AVFrame *frame = av_frame_alloc();
     AVSubtitle subtitle;
     AVPacket pkt = *avpkt;
 
@@ -2841,9 +2846,10 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
                 goto find_stream_info_err;
         }
 
-        read_size += pkt->size;
-
         st = ic->streams[pkt->stream_index];
+        if (!(st->disposition & AV_DISPOSITION_ATTACHED_PIC))
+            read_size += pkt->size;
+
         if (pkt->dts != AV_NOPTS_VALUE && st->codec_info_nb_frames > 1) {
             /* check for non-increasing dts */
             if (st->info->fps_last_dts != AV_NOPTS_VALUE &&
@@ -4166,7 +4172,7 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st,
     return AVERROR(EINVAL);
 }
 
-void ff_generate_avci_extradata(AVStream *st)
+int ff_generate_avci_extradata(AVStream *st)
 {
     static const uint8_t avci100_1080p_extradata[] = {
         // SPS
@@ -4233,8 +4239,10 @@ void ff_generate_avci_extradata(AVStream *st)
         0x00, 0x00, 0x00, 0x01, 0x68, 0xce, 0x31, 0x12,
         0x11
     };
+
+    const uint8_t *data = NULL;
     int size = 0;
-    const uint8_t *data = 0;
+
     if (st->codec->width == 1920) {
         if (st->codec->field_order == AV_FIELD_PROGRESSIVE) {
             data = avci100_1080p_extradata;
@@ -4250,10 +4258,14 @@ void ff_generate_avci_extradata(AVStream *st)
         data = avci100_720p_extradata;
         size = sizeof(avci100_720p_extradata);
     }
+
     if (!size)
-        return;
+        return 0;
+
     av_freep(&st->codec->extradata);
     if (ff_alloc_extradata(st->codec, size))
-        return;
+        return AVERROR(ENOMEM);
     memcpy(st->codec->extradata, data, size);
+
+    return 0;
 }