[FFmpeg-devel] [PATCH] avformat/dsddec: create audio stream before processing id3

Peter Ross pross at xvid.org
Fri Apr 18 07:56:28 CEST 2014


This ensures stream[0] is always the audio stream (an assumption made
in dsf_read_packet).

Signed-off-by: Peter Ross <pross at xvid.org>
---
 libavformat/dsfdec.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/libavformat/dsfdec.c b/libavformat/dsfdec.c
index 74fd7aa..fee551d 100644
--- a/libavformat/dsfdec.c
+++ b/libavformat/dsfdec.c
@@ -70,6 +70,11 @@ static int dsf_read_header(AVFormatContext *s)
     if (avio_rl64(pb) != 28)
         return AVERROR_INVALIDDATA;
 
+    /* create primary stream before any id3 coverart streams */
+    st = avformat_new_stream(s, NULL);
+    if (!st)
+        return AVERROR(ENOMEM);
+
     avio_skip(pb, 8);
     id3pos = avio_rl64(pb);
     if (pb->seekable) {
@@ -92,10 +97,6 @@ static int dsf_read_header(AVFormatContext *s)
         return AVERROR_INVALIDDATA;
     }
 
-    st = avformat_new_stream(s, NULL);
-    if (!st)
-        return AVERROR(ENOMEM);
-
     channel_type = avio_rl32(pb);
     if (channel_type < FF_ARRAY_ELEMS(dsf_channel_layout))
         st->codec->channel_layout = dsf_channel_layout[channel_type];
-- 
1.8.3.2

-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140418/534a44b0/attachment.asc>


More information about the ffmpeg-devel mailing list