Browse code

be slightly more careful with copying the codec_tag in the streamcopy case fixes streamcopy of Xmen-avc-500.vp6 into flv closes issue 57

Originally committed as revision 9909 to svn://svn.ffmpeg.org/ffmpeg/trunk

Michael Niedermayer authored on 2007/08/05 01:03:39
Showing 1 changed files
... ...
@@ -1503,6 +1503,7 @@ static int av_encode(AVFormatContext **output_files,
1503 1503
     /* for each output stream, we compute the right encoding parameters */
1504 1504
     for(i=0;i<nb_ostreams;i++) {
1505 1505
         ost = ost_table[i];
1506
+        os = output_files[ost->file_index];
1506 1507
         ist = ist_table[ost->source_index];
1507 1508
 
1508 1509
         codec = ost->st->codec;
... ...
@@ -1516,7 +1517,14 @@ static int av_encode(AVFormatContext **output_files,
1516 1516
             /* if stream_copy is selected, no need to decode or encode */
1517 1517
             codec->codec_id = icodec->codec_id;
1518 1518
             codec->codec_type = icodec->codec_type;
1519
-            if(!codec->codec_tag) codec->codec_tag = icodec->codec_tag;
1519
+
1520
+            if(!codec->codec_tag){
1521
+                if(   !os->oformat->codec_tag
1522
+                   || av_codec_get_id (os->oformat->codec_tag, icodec->codec_tag) > 0
1523
+                   || av_codec_get_tag(os->oformat->codec_tag, icodec->codec_id) <= 0)
1524
+                    codec->codec_tag = icodec->codec_tag;
1525
+            }
1526
+
1520 1527
             codec->bit_rate = icodec->bit_rate;
1521 1528
             codec->extradata= icodec->extradata;
1522 1529
             codec->extradata_size= icodec->extradata_size;