]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/utils.c
avfilter/showspectrum: add blackman window.
[ffmpeg] / libavformat / utils.c
index f02312f37254cab4df5c4187b33e2cb7f44bf927..9522909bfcb0441cadb9ef5c2e9bfd8acc5b870b 100644 (file)
@@ -2448,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;
 
@@ -2846,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 &&
@@ -4171,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
@@ -4238,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;
@@ -4255,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;
 }