]> git.sesse.net Git - ffmpeg/commitdiff
update sub_id in mpegaudio decoding (might need same method as MPEG2VIDEO too ?)
authorFabrice Bellard <fabrice@bellard.org>
Mon, 8 Sep 2003 22:49:26 +0000 (22:49 +0000)
committerFabrice Bellard <fabrice@bellard.org>
Mon, 8 Sep 2003 22:49:26 +0000 (22:49 +0000)
Originally committed as revision 2238 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/mpegaudiodec.c
libavcodec/utils.c

index 43ec55daf22a2bb349a81a930f833cf06089f75d..51c8ef1305afefb92ba5ad9ab578f45539481af5 100644 (file)
@@ -2481,6 +2481,7 @@ static int decode_frame(AVCodecContext * avctx,
                     avctx->sample_rate = s->sample_rate;
                     avctx->channels = s->nb_channels;
                     avctx->bit_rate = s->bit_rate;
+                    avctx->sub_id = s->layer;
                     switch(s->layer) {
                     case 1:
                         avctx->frame_size = 384;
index 33ff0f41537a76f1dc32d61cedbd6bb435d54dd7..c2705889ba517a2928c6284e642f6ba3a8fc043f 100644 (file)
@@ -470,6 +470,12 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
 
     if (p) {
         codec_name = p->name;
+        if (!encode && enc->codec_id == CODEC_ID_MP3) {
+            if (enc->sub_id == 2)
+                codec_name = "mp2";
+            else if (enc->sub_id == 1)
+                codec_name = "mp1";
+        }
     } else if (enc->codec_name[0] != '\0') {
         codec_name = enc->codec_name;
     } else {