[vlc-devel] [PATCH 2/2] differentiate mpga (layer 2) and mp3 (layer 3) codecs
Ilkka Ollakka
ileoo at videolan.org
Wed Jan 8 13:59:42 CET 2014
---
include/vlc_codecs.h | 2 +-
modules/audio_filter/converter/mpgatofixed32.c | 1 +
modules/codec/avcodec/encoder.c | 14 +-------------
modules/codec/avcodec/fourcc.c | 3 ++-
modules/codec/mpeg_audio.c | 3 ++-
5 files changed, 7 insertions(+), 16 deletions(-)
diff --git a/include/vlc_codecs.h b/include/vlc_codecs.h
index af3fba5..0e7b59c 100644
--- a/include/vlc_codecs.h
+++ b/include/vlc_codecs.h
@@ -374,7 +374,7 @@ wave_format_tag_to_fourcc[] =
{ WAVE_FORMAT_G723_1, VLC_CODEC_G723_1, "G.723.1" },
{ WAVE_FORMAT_MSG723, VLC_CODEC_G723_1, "Microsoft G.723 [G723.1]" },
{ WAVE_FORMAT_VIVOG723, VLC_CODEC_G723_1, "Vivo G.723.1" },
- { WAVE_FORMAT_MPEGLAYER3, VLC_CODEC_MPGA, "Mpeg Audio" },
+ { WAVE_FORMAT_MPEGLAYER3, VLC_CODEC_MP3, "Mpeg Audio Layer 3" },
{ WAVE_FORMAT_MPEG, VLC_CODEC_MPGA, "Mpeg Audio" },
{ WAVE_FORMAT_AMR_NB, VLC_CODEC_AMR_NB, "AMR NB" },
{ WAVE_FORMAT_AMR_WB, VLC_CODEC_AMR_WB, "AMR Wideband" },
diff --git a/modules/audio_filter/converter/mpgatofixed32.c b/modules/audio_filter/converter/mpgatofixed32.c
index 781af87..34714e8 100644
--- a/modules/audio_filter/converter/mpgatofixed32.c
+++ b/modules/audio_filter/converter/mpgatofixed32.c
@@ -156,6 +156,7 @@ static int OpenFilter( vlc_object_t *p_this )
filter_sys_t *p_sys;
if( p_filter->fmt_in.audio.i_format != VLC_CODEC_MPGA &&
+ p_filter->fmt_in.audio.i_format != VLC_CODEC_MP3 &&
p_filter->fmt_in.audio.i_format != VLC_FOURCC('m','p','g','3') )
return VLC_EGENERIC;
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 8203fe6..ac0f897 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -220,19 +220,7 @@ int OpenEncoder( vlc_object_t *p_this )
config_ChainParse( p_enc, ENC_CFG_PREFIX, ppsz_enc_options, p_enc->p_cfg );
- if( p_enc->fmt_out.i_codec == VLC_CODEC_MP3 )
- {
- i_cat = AUDIO_ES;
- i_codec_id = AV_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 = AV_CODEC_ID_MP2;
- psz_namecodec = "MPEG I/II Layer 2";
- }
- else if( p_enc->fmt_out.i_codec == VLC_CODEC_MP1V )
+ if( p_enc->fmt_out.i_codec == VLC_CODEC_MP1V )
{
i_cat = VIDEO_ES;
i_codec_id = AV_CODEC_ID_MPEG1VIDEO;
diff --git a/modules/codec/avcodec/fourcc.c b/modules/codec/avcodec/fourcc.c
index 9aa136f..3422212 100644
--- a/modules/codec/avcodec/fourcc.c
+++ b/modules/codec/avcodec/fourcc.c
@@ -363,8 +363,9 @@ static const struct
/* AV_CODEC_ID_SOL_DPCM */
/* audio codecs */
- { VLC_CODEC_MPGA, AV_CODEC_ID_MP3, AUDIO_ES }, /* prefer MP3 over MP2 */
+ { VLC_CODEC_MP3, AV_CODEC_ID_MP3, AUDIO_ES }, /* prefer MP3 over MP2 */
{ VLC_CODEC_MPGA, AV_CODEC_ID_MP2, AUDIO_ES },
+ { VLC_CODEC_MP2, AV_CODEC_ID_MP2, AUDIO_ES },
{ VLC_CODEC_MP4A, AV_CODEC_ID_AAC, AUDIO_ES },
{ VLC_CODEC_A52, AV_CODEC_ID_AC3, AUDIO_ES },
{ VLC_CODEC_DTS, AV_CODEC_ID_DTS, AUDIO_ES },
diff --git a/modules/codec/mpeg_audio.c b/modules/codec/mpeg_audio.c
index 8a1daba..e67abeb 100644
--- a/modules/codec/mpeg_audio.c
+++ b/modules/codec/mpeg_audio.c
@@ -124,7 +124,8 @@ static int Open( vlc_object_t *p_this )
decoder_t *p_dec = (decoder_t*)p_this;
decoder_sys_t *p_sys;
- if( p_dec->fmt_in.i_codec != VLC_CODEC_MPGA )
+ if(( p_dec->fmt_in.i_codec != VLC_CODEC_MPGA ) &&
+ ( p_dec->fmt_in.i_codec != VLC_CODEC_MP3 ) )
{
return VLC_EGENERIC;
}
--
1.8.4
More information about the vlc-devel
mailing list