Skip to content

Commit

Permalink
lame: Use libav wrapper to encode mp3lame
Browse files Browse the repository at this point in the history
Fixes https://forum.handbrake.fr/viewtopic.php?f=12&t=33345
Some players expect each packet to start on an mp3 frame header. Our
mp3lame encoder did not ensure this and resulted in failure to play
audio on these players.

libav already has the necessary code to parse headers and
accumulate a full frame of data, so use it.
  • Loading branch information
jstebbins committed Oct 26, 2015
1 parent 7d77400 commit d05e644
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 232 deletions.
2 changes: 2 additions & 0 deletions contrib/ffmpeg/module.defs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,14 @@ FFMPEG.CONFIGURE.extra = \
--disable-network \
--disable-hwaccels \
--disable-encoders \
--enable-libmp3lame \
--enable-encoder=aac \
--enable-encoder=ac3 \
--enable-encoder=eac3 \
--enable-encoder=flac \
--enable-encoder=mpeg2video \
--enable-encoder=mpeg4 \
--enable-encoder=libmp3lame \
--enable-libvpx \
--enable-encoder=libvpx_vp8 \
--disable-decoder=libvpx_vp8 \
Expand Down
1 change: 0 additions & 1 deletion libhb/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,6 @@ extern hb_work_object_t hb_encx265;
extern hb_work_object_t hb_decavcodeca;
extern hb_work_object_t hb_decavcodecv;
extern hb_work_object_t hb_declpcm;
extern hb_work_object_t hb_enclame;
extern hb_work_object_t hb_encvorbis;
extern hb_work_object_t hb_muxer;
extern hb_work_object_t hb_encca_aac;
Expand Down
4 changes: 4 additions & 0 deletions libhb/encavcodecaudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ static int encavcodecaInit(hb_work_object_t *w, hb_job_t *job)
}
break;

case HB_ACODEC_LAME:
codec_name = "libmp3lame";
break;

default:
hb_error("encavcodecaInit: unsupported codec (0x%x)",
audio->config.out.codec);
Expand Down
228 changes: 0 additions & 228 deletions libhb/enclame.c

This file was deleted.

1 change: 0 additions & 1 deletion libhb/hb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,6 @@ int hb_global_init()
hb_register(&hb_encca_aac);
hb_register(&hb_encca_haac);
#endif
hb_register(&hb_enclame);
hb_register(&hb_enctheora);
hb_register(&hb_encvorbis);
hb_register(&hb_encx264);
Expand Down
4 changes: 2 additions & 2 deletions libhb/work.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ hb_work_object_t* hb_codec_encoder(hb_handle_t *h, int codec)
}
switch (codec)
{
case HB_ACODEC_AC3: return hb_get_work(h, WORK_ENCAVCODEC_AUDIO);
case HB_ACODEC_LAME: return hb_get_work(h, WORK_ENCLAME);
case HB_ACODEC_AC3:
case HB_ACODEC_LAME: return hb_get_work(h, WORK_ENCAVCODEC_AUDIO);
case HB_ACODEC_VORBIS: return hb_get_work(h, WORK_ENCVORBIS);
case HB_ACODEC_CA_AAC: return hb_get_work(h, WORK_ENC_CA_AAC);
case HB_ACODEC_CA_HAAC: return hb_get_work(h, WORK_ENC_CA_HAAC);
Expand Down

0 comments on commit d05e644

Please sign in to comment.