diff options
author | Rodeo <[email protected]> | 2013-01-02 21:44:38 +0000 |
---|---|---|
committer | Rodeo <[email protected]> | 2013-01-02 21:44:38 +0000 |
commit | a2a844aaf85c003320170d446adcdb14e05317cc (patch) | |
tree | a376b4ada55ddc3ffd91d8491a5e42ba165dde63 /libhb | |
parent | 036e9b30ce75ebe78ad8c6e4ce5de7cf6c12777f (diff) |
FLAC: add 24-bit encoding.
Works via a dedicated encoder: "FLAC (24-bit)", "ffflac24".
Users who prefer 16-bit can use the previous FLAC encoder: "FLAC (ffmpeg)", "ffflac".
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5134 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/common.c | 9 | ||||
-rw-r--r-- | libhb/common.h | 5 | ||||
-rw-r--r-- | libhb/encavcodecaudio.c | 22 | ||||
-rw-r--r-- | libhb/muxmkv.c | 15 | ||||
-rw-r--r-- | libhb/work.c | 1 |
5 files changed, 35 insertions, 17 deletions
diff --git a/libhb/common.c b/libhb/common.c index 5cf4fc1f5..af47f9f89 100644 --- a/libhb/common.c +++ b/libhb/common.c @@ -125,6 +125,7 @@ hb_encoder_t hb_audio_encoders[] = { "MP3 Passthru", "copy:mp3", HB_ACODEC_MP3_PASS, HB_MUX_MP4|HB_MUX_MKV }, { "Vorbis (vorbis)", "vorbis", HB_ACODEC_VORBIS, HB_MUX_MKV }, { "FLAC (ffmpeg)", "ffflac", HB_ACODEC_FFFLAC, HB_MUX_MKV }, + { "FLAC (24-bit)", "ffflac24", HB_ACODEC_FFFLAC24, HB_MUX_MKV }, { "Auto Passthru", "copy", HB_ACODEC_AUTO_PASS, HB_MUX_MP4|HB_MUX_MKV }, }; int hb_audio_encoders_count = sizeof(hb_audio_encoders) / sizeof(hb_encoder_t); @@ -161,8 +162,9 @@ int hb_mixdown_has_codec_support(int mixdown, uint32_t codec) switch (codec) { - case HB_ACODEC_FFFLAC: case HB_ACODEC_VORBIS: + case HB_ACODEC_FFFLAC: + case HB_ACODEC_FFFLAC24: return (mixdown <= HB_AMIXDOWN_7POINT1); case HB_ACODEC_LAME: @@ -597,6 +599,7 @@ void hb_get_audio_bitrate_limits(uint32_t codec, int samplerate, int mixdown, { // Bitrates don't apply to "lossless" audio case HB_ACODEC_FFFLAC: + case HB_ACODEC_FFFLAC24: *low = *high = -1; return; @@ -715,6 +718,7 @@ int hb_get_default_audio_bitrate(uint32_t codec, int samplerate, int mixdown) switch (codec) { case HB_ACODEC_FFFLAC: + case HB_ACODEC_FFFLAC24: return -1; // 96, 224, 640 Kbps @@ -825,6 +829,7 @@ void hb_get_audio_compression_limits(uint32_t codec, float *low, float *high, switch (codec) { case HB_ACODEC_FFFLAC: + case HB_ACODEC_FFFLAC24: *direction = 0; *granularity = 1; *high = 12; @@ -863,6 +868,7 @@ float hb_get_default_audio_compression(uint32_t codec) switch (codec) { case HB_ACODEC_FFFLAC: + case HB_ACODEC_FFFLAC24: return 5.; case HB_ACODEC_LAME: @@ -900,6 +906,7 @@ int hb_get_default_mixdown(uint32_t codec, uint64_t layout) { // the FLAC encoder defaults to the best mixdown up to 7.1 case HB_ACODEC_FFFLAC: + case HB_ACODEC_FFFLAC24: mixdown = HB_AMIXDOWN_7POINT1; break; // the AC3 encoder defaults to the best mixdown up to 5.1 diff --git a/libhb/common.h b/libhb/common.h index 0b6d6ec2c..fd49d4d29 100644 --- a/libhb/common.h +++ b/libhb/common.h @@ -449,7 +449,7 @@ struct hb_job_s /* Audio starts here */ /* Audio Codecs */ -#define HB_ACODEC_MASK 0x001FFF00 +#define HB_ACODEC_MASK 0x003FFF00 #define HB_ACODEC_FAAC 0x00000100 #define HB_ACODEC_LAME 0x00000200 #define HB_ACODEC_VORBIS 0x00000400 @@ -463,7 +463,8 @@ struct hb_job_s #define HB_ACODEC_DCA_HD 0x00040000 #define HB_ACODEC_MP3 0x00080000 #define HB_ACODEC_FFFLAC 0x00100000 -#define HB_ACODEC_FF_MASK 0x001f2000 +#define HB_ACODEC_FFFLAC24 0x00200000 +#define HB_ACODEC_FF_MASK 0x003F2000 #define HB_ACODEC_PASS_FLAG 0x40000000 #define HB_ACODEC_PASS_MASK (HB_ACODEC_MP3 | HB_ACODEC_FFAAC | HB_ACODEC_DCA_HD | HB_ACODEC_AC3 | HB_ACODEC_DCA) #define HB_ACODEC_AUTO_PASS (HB_ACODEC_PASS_MASK | HB_ACODEC_PASS_FLAG) diff --git a/libhb/encavcodecaudio.c b/libhb/encavcodecaudio.c index db09e8a6f..669691dc1 100644 --- a/libhb/encavcodecaudio.c +++ b/libhb/encavcodecaudio.c @@ -91,14 +91,22 @@ static int encavcodecaInit(hb_work_object_t *w, hb_job_t *job) context->compression_level = audio->config.out.compression_level; } - // set the sample_fmt to something practical - if (audio->config.out.codec == HB_ACODEC_FFFLAC) + // set the sample format and bit depth to something practical + switch (audio->config.out.codec) { - hb_ff_set_sample_fmt(context, codec, AV_SAMPLE_FMT_S16); - } - else - { - hb_ff_set_sample_fmt(context, codec, AV_SAMPLE_FMT_FLT); + case HB_ACODEC_FFFLAC: + hb_ff_set_sample_fmt(context, codec, AV_SAMPLE_FMT_S16); + context->bits_per_raw_sample = 16; + break; + + case HB_ACODEC_FFFLAC24: + hb_ff_set_sample_fmt(context, codec, AV_SAMPLE_FMT_S32); + context->bits_per_raw_sample = 24; + break; + + default: + hb_ff_set_sample_fmt(context, codec, AV_SAMPLE_FMT_FLTP); + break; } if (hb_avcodec_open(context, codec, &av_opts, 0)) diff --git a/libhb/muxmkv.c b/libhb/muxmkv.c index 735bb631e..e45ebb126 100644 --- a/libhb/muxmkv.c +++ b/libhb/muxmkv.c @@ -247,11 +247,11 @@ static int MKVInit( hb_mux_object_t * m ) } break; case HB_ACODEC_FFFLAC: - if( audio->priv.config.extradata.bytes ) + case HB_ACODEC_FFFLAC24: + if (audio->priv.config.extradata.bytes) { - track->codecPrivate = create_flac_header( - audio->priv.config.extradata.bytes, - audio->priv.config.extradata.length ); + track->codecPrivate = create_flac_header(audio->priv.config.extradata.bytes, + audio->priv.config.extradata.length); track->codecPrivateSize = audio->priv.config.extradata.length + 8; } track->codecID = MK_ACODEC_FLAC; @@ -307,9 +307,10 @@ static int MKVInit( hb_mux_object_t * m ) track->extra.audio.channels = hb_mixdown_get_discrete_channel_count(audio->config.out.mixdown); } mux_data->track = mk_createTrack(m->file, track); - if( audio->config.out.codec == HB_ACODEC_VORBIS || - audio->config.out.codec == HB_ACODEC_FFFLAC ) - free( track->codecPrivate ); + if (audio->config.out.codec == HB_ACODEC_VORBIS || + audio->config.out.codec == HB_ACODEC_FFFLAC || + audio->config.out.codec == HB_ACODEC_FFFLAC24) + free(track->codecPrivate); } char * subidx_fmt = diff --git a/libhb/work.c b/libhb/work.c index c6ddd9472..137b9434b 100644 --- a/libhb/work.c +++ b/libhb/work.c @@ -144,6 +144,7 @@ hb_work_object_t * hb_codec_encoder( int codec ) return w; } case HB_ACODEC_FFFLAC: + case HB_ACODEC_FFFLAC24: { w = hb_get_work( WORK_ENCAVCODEC_AUDIO ); w->codec_param = AV_CODEC_ID_FLAC; |