diff options
author | jstebbins <[email protected]> | 2011-10-12 20:19:33 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2011-10-12 20:19:33 +0000 |
commit | 9d95d88d5a05abf6086ab474c0aa2583a9da6345 (patch) | |
tree | 5ff672576f6efacb2f03a36b85a88a8b2d3e85e1 /libhb/muxmkv.c | |
parent | d41d9e0d88a689a11fe0978d4e415b89e72c2e62 (diff) |
Add flac + quality + compression level support
Adds flac audio to cli, lingui, and macgui
Adds quality and compression level options to cli
Adds quality option to lingui
Quality option works for vorbis and lame
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4281 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/muxmkv.c')
-rw-r--r-- | libhb/muxmkv.c | 61 |
1 files changed, 58 insertions, 3 deletions
diff --git a/libhb/muxmkv.c b/libhb/muxmkv.c index 2ec32139d..524ca9d0a 100644 --- a/libhb/muxmkv.c +++ b/libhb/muxmkv.c @@ -35,6 +35,19 @@ struct hb_mux_data_s int sub_format; }; +static uint8_t * create_flac_header( uint8_t *data, int size ) +{ + uint8_t * out; + uint8_t header[8] = { + 0x66, 0x4C, 0x61, 0x43, 0x80, 0x00, 0x00, 0x22 + }; + + out = malloc( size + 8 ); + memcpy( out, header, 8 ); + memcpy( out + 8, data, size ); + return out; +} + /********************************************************************** * MKVInit ********************************************************************** @@ -228,12 +241,22 @@ static int MKVInit( hb_mux_object_t * m ) track->codecPrivateSize = cp_size; } break; + case HB_ACODEC_FFFLAC: + if( audio->priv.config.extradata.bytes ) + { + 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; + break; case HB_ACODEC_FAAC: case HB_ACODEC_FFAAC: case HB_ACODEC_CA_AAC: case HB_ACODEC_CA_HAAC: - track->codecPrivate = audio->priv.config.aac.bytes; - track->codecPrivateSize = audio->priv.config.aac.length; + track->codecPrivate = audio->priv.config.extradata.bytes; + track->codecPrivateSize = audio->priv.config.extradata.length; track->codecID = MK_ACODEC_AAC; break; default: @@ -267,7 +290,8 @@ static int MKVInit( hb_mux_object_t * m ) } // track->defaultDuration = job->arate * 1000; mux_data->track = mk_createTrack(m->file, track); - if (audio->config.out.codec == HB_ACODEC_VORBIS && track->codecPrivate != NULL) + if ( audio->config.out.codec == HB_ACODEC_VORBIS || + audio->config.out.codec == HB_ACODEC_FFFLAC ) free(track->codecPrivate); } @@ -545,6 +569,37 @@ static int MKVEnd( hb_mux_object_t * m ) mk_createTagSimple( m->file, MK_TAG_GENRE, md->genre ); } + // Update and track private data that can change during + // encode. + int i; + for( i = 0; i < hb_list_count( title->list_audio ); i++ ) + { + mk_Track * track; + hb_audio_t * audio; + + audio = hb_list_item( title->list_audio, i ); + track = audio->priv.mux_data->track; + + switch (audio->config.out.codec & HB_ACODEC_MASK) + { + case HB_ACODEC_FFFLAC: + if( audio->priv.config.extradata.bytes ) + { + uint8_t *header; + header = create_flac_header( + audio->priv.config.extradata.bytes, + audio->priv.config.extradata.length ); + mk_updateTrackPrivateData( m->file, track, + header, + audio->priv.config.extradata.length + 8 ); + free( header ); + } + break; + default: + break; + } + } + if( mk_close(m->file) < 0 ) { hb_error( "Failed to flush the last frame and close the output file, Disk Full?" ); |