]> git.sesse.net Git - ffmpeg/commitdiff
idcin: fix check for presence of an audio stream
authorJustin Ruggles <justin.ruggles@gmail.com>
Wed, 1 Aug 2012 19:57:31 +0000 (15:57 -0400)
committerJustin Ruggles <justin.ruggles@gmail.com>
Wed, 9 Jan 2013 19:49:06 +0000 (14:49 -0500)
libavformat/idcin.c

index 6b107b9904e2bf1644b4192b90c741a9cf335d7e..aa196c8b494b0f45f768d0862d73583c9757a646 100644 (file)
@@ -170,6 +170,10 @@ static int idcin_read_header(AVFormatContext *s)
             av_log(s, AV_LOG_ERROR, "invalid channels: %u\n", channels);
             return AVERROR_INVALIDDATA;
         }
+        idcin->audio_present = 1;
+    } else {
+        /* if sample rate is 0, assume no audio */
+        idcin->audio_present = 0;
     }
 
     st = avformat_new_stream(s, NULL);
@@ -190,8 +194,7 @@ static int idcin_read_header(AVFormatContext *s)
         HUFFMAN_TABLE_SIZE)
         return AVERROR(EIO);
 
-    /* if sample rate is 0, assume no audio */
-    if (sample_rate) {
+    if (idcin->audio_present) {
         idcin->audio_present = 1;
         st = avformat_new_stream(s, NULL);
         if (!st)
@@ -220,8 +223,7 @@ static int idcin_read_header(AVFormatContext *s)
                 (sample_rate / 14) * bytes_per_sample * channels;
         }
         idcin->current_audio_chunk = 0;
-    } else
-        idcin->audio_present = 1;
+    }
 
     idcin->next_chunk_is_video = 1;
     idcin->pts = 0;