Commit 16aec732 authored by Laurent Aimar's avatar Laurent Aimar

Allowed to use mp2/mp3 to specify layer 2/3 for mpeg audio encoder.

It might be better (dunno if it would be simpler) to have a way to
specify some kind of profile.
parent 4ae75d47
...@@ -374,6 +374,8 @@ ...@@ -374,6 +374,8 @@
#define VLC_CODEC_MP1V VLC_FOURCC('m','p','1','v') #define VLC_CODEC_MP1V VLC_FOURCC('m','p','1','v')
/* MPEG-2 video */ /* MPEG-2 video */
#define VLC_CODEC_MP2V VLC_FOURCC('m','p','2','v') #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 */ /* MPEG-I/II layer 3 audio */
#define VLC_CODEC_MP3 VLC_FOURCC('m','p','3',' ') #define VLC_CODEC_MP3 VLC_FOURCC('m','p','3',' ')
......
...@@ -203,7 +203,19 @@ int OpenEncoder( vlc_object_t *p_this ) ...@@ -203,7 +203,19 @@ int OpenEncoder( vlc_object_t *p_this )
char *psz_val; char *psz_val;
int i_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 ) ) &psz_namecodec ) )
{ {
if( TestFfmpegChroma( -1, p_enc->fmt_out.i_codec ) != VLC_SUCCESS ) if( TestFfmpegChroma( -1, p_enc->fmt_out.i_codec ) != VLC_SUCCESS )
......
...@@ -79,8 +79,8 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -79,8 +79,8 @@ static int OpenEncoder( vlc_object_t *p_this )
encoder_t *p_enc = (encoder_t*)p_this; encoder_t *p_enc = (encoder_t*)p_this;
encoder_sys_t *p_sys; encoder_sys_t *p_sys;
/* FIXME: what about layers 1 and 2 ? shine is an 'MP3' encoder */ /* shine is an 'MP3' encoder */
if( p_enc->fmt_out.i_codec != VLC_CODEC_MP3 || 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 ) p_enc->fmt_out.audio.i_channels > 2 )
return VLC_EGENERIC; return VLC_EGENERIC;
......
...@@ -130,9 +130,8 @@ static int OpenEncoder( vlc_object_t *p_this ) ...@@ -130,9 +130,8 @@ static int OpenEncoder( vlc_object_t *p_this )
encoder_sys_t *p_sys; encoder_sys_t *p_sys;
int i_frequency; int i_frequency;
if( p_enc->fmt_out.i_codec != VLC_CODEC_MPGA && if( p_enc->fmt_out.i_codec != VLC_CODEC_MP2 &&
p_enc->fmt_out.i_codec != VLC_FOURCC('m','p','2','a') && p_enc->fmt_out.i_codec != VLC_CODEC_MPGA &&
p_enc->fmt_out.i_codec != VLC_FOURCC('m','p','2',' ') &&
!p_enc->b_force ) !p_enc->b_force )
{ {
return VLC_EGENERIC; return VLC_EGENERIC;
......
...@@ -299,9 +299,10 @@ static int Open( vlc_object_t *p_this ) ...@@ -299,9 +299,10 @@ static int Open( vlc_object_t *p_this )
if( p_sys->i_acodec ) if( p_sys->i_acodec )
{ {
if( ( p_sys->i_acodec == VLC_CODEC_MP3 || 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 ) 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 );
p_sys->i_channels = 2; p_sys->i_channels = 2;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment