]> git.sesse.net Git - vlc/commitdiff
Allowed to use mp2/mp3 to specify layer 2/3 for mpeg audio encoder.
authorLaurent Aimar <fenrir@videolan.org>
Tue, 1 Nov 2011 13:34:24 +0000 (14:34 +0100)
committerLaurent Aimar <fenrir@videolan.org>
Tue, 1 Nov 2011 13:36:29 +0000 (14:36 +0100)
It might be better (dunno if it would be simpler) to have a way to
specify some kind of profile.

include/vlc_fourcc.h
modules/codec/avcodec/encoder.c
modules/codec/shine/shine_mod.c
modules/codec/twolame.c
modules/stream_out/transcode/transcode.c

index 83ad3d3b5840df1eb70e7d1cb1b6deabff425228..32e113f012c0282123634aadc5bbb5d189c47108 100644 (file)
 #define VLC_CODEC_MP1V      VLC_FOURCC('m','p','1','v')
 /* MPEG-2 video */
 #define VLC_CODEC_MP2V      VLC_FOURCC('m','p','2','v')
+/* MPEG-I/II layer 2 audio */
+#define VLC_CODEC_MP2       VLC_FOURCC('m','p','2',' ')
 /* MPEG-I/II layer 3 audio */
 #define VLC_CODEC_MP3       VLC_FOURCC('m','p','3',' ')
 
index d0386731ea5d335340255342d4f47a38d7954385..08233695a4aae36de04df2996bca4f40cdc5b113 100644 (file)
@@ -203,7 +203,19 @@ int OpenEncoder( vlc_object_t *p_this )
     char *psz_val;
     int i_val;
 
-    if( !GetFfmpegCodec( p_enc->fmt_out.i_codec, &i_cat, &i_codec_id,
+    if( p_enc->fmt_out.i_codec == VLC_CODEC_MP3 )
+    {
+        i_cat = AUDIO_ES;
+        i_codec_id = CODEC_ID_MP3;
+        psz_namecodec = "MPEG I/II Layer 3";
+    }
+    else if( p_enc->fmt_out.i_codec == VLC_CODEC_MP2 )
+    {
+        i_cat = AUDIO_ES;
+        i_codec_id = CODEC_ID_MP2;
+        psz_namecodec = "MPEG I/II Layer 2";
+    }
+    else if( !GetFfmpegCodec( p_enc->fmt_out.i_codec, &i_cat, &i_codec_id,
                              &psz_namecodec ) )
     {
         if( TestFfmpegChroma( -1, p_enc->fmt_out.i_codec ) != VLC_SUCCESS )
index 37e2e983384e092b0268ae009ccec3e9decaee30..54491ecb1e649f68f23ba6b9043d02a8e4940aed 100644 (file)
@@ -79,8 +79,8 @@ static int OpenEncoder( vlc_object_t *p_this )
     encoder_t *p_enc = (encoder_t*)p_this;
     encoder_sys_t *p_sys;
 
-    /* FIXME: what about layers 1 and 2 ? shine is an 'MP3' encoder */
-    if( p_enc->fmt_out.i_codec != VLC_CODEC_MP3 ||
+    /* shine is an 'MP3' encoder */
+    if( (p_enc->fmt_out.i_codec != VLC_CODEC_MP3 && p_enc->fmt_out.i_codec != VLC_CODEC_MPGA) ||
         p_enc->fmt_out.audio.i_channels > 2 )
         return VLC_EGENERIC;
 
index 91bd55b5c0cfe42e56a2586e935c45e928d8b743..440e152e41e853dd4aa73b68d6b801363ae3cf2d 100644 (file)
@@ -130,9 +130,8 @@ static int OpenEncoder( vlc_object_t *p_this )
     encoder_sys_t *p_sys;
     int i_frequency;
 
-    if( p_enc->fmt_out.i_codec != VLC_CODEC_MPGA &&
-        p_enc->fmt_out.i_codec != VLC_FOURCC('m','p','2','a') &&
-        p_enc->fmt_out.i_codec != VLC_FOURCC('m','p','2',' ') &&
+    if( p_enc->fmt_out.i_codec != VLC_CODEC_MP2 &&
+        p_enc->fmt_out.i_codec != VLC_CODEC_MPGA &&
         !p_enc->b_force )
     {
         return VLC_EGENERIC;
index 8df202abb8f1610338a30b91024fa8b80b24ce9b..1c81007ae7bc958325ea256804af2f9d7ddcafb9 100644 (file)
@@ -299,9 +299,10 @@ static int Open( vlc_object_t *p_this )
     if( p_sys->i_acodec )
     {
         if( ( p_sys->i_acodec == VLC_CODEC_MP3 ||
+              p_sys->i_acodec == VLC_CODEC_MP2 ||
               p_sys->i_acodec == VLC_CODEC_MPGA ) && p_sys->i_channels > 2 )
         {
-            msg_Warn( p_stream, "%d channels invalid for mp3, forcing to 2",
+            msg_Warn( p_stream, "%d channels invalid for mp2/mp3, forcing to 2",
                       p_sys->i_channels );
             p_sys->i_channels = 2;
         }