summaryrefslogtreecommitdiffstats
path: root/libhb/encvorbis.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2011-10-12 20:19:33 +0000
committerjstebbins <[email protected]>2011-10-12 20:19:33 +0000
commit9d95d88d5a05abf6086ab474c0aa2583a9da6345 (patch)
tree5ff672576f6efacb2f03a36b85a88a8b2d3e85e1 /libhb/encvorbis.c
parentd41d9e0d88a689a11fe0978d4e415b89e72c2e62 (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/encvorbis.c')
-rw-r--r--libhb/encvorbis.c44
1 files changed, 29 insertions, 15 deletions
diff --git a/libhb/encvorbis.c b/libhb/encvorbis.c
index fc186e089..8ac2e1a58 100644
--- a/libhb/encvorbis.c
+++ b/libhb/encvorbis.c
@@ -56,16 +56,6 @@ int encvorbisInit( hb_work_object_t * w, hb_job_t * job )
hb_log( "encvorbis: opening libvorbis" );
- /* 28kbps/channel seems to be the minimum for 6ch vorbis. */
- int min_bitrate = 28 * pv->out_discrete_channels;
- if (pv->out_discrete_channels > 2 && audio->config.out.bitrate < min_bitrate)
- {
- hb_log( "encvorbis: Selected bitrate (%d kbps) too low for %d channel audio.", audio->config.out.bitrate, pv->out_discrete_channels);
- hb_log( "encvorbis: Resetting bitrate to %d kbps", min_bitrate);
- /* Naughty! We shouldn't modify the audio from here. */
- audio->config.out.bitrate = min_bitrate;
- }
-
/* init */
for( i = 0; i < 3; i++ )
{
@@ -74,12 +64,36 @@ int encvorbisInit( hb_work_object_t * w, hb_job_t * job )
memset( w->config->vorbis.headers[i], 0, sizeof( ogg_packet ) );
}
vorbis_info_init( &pv->vi );
- if( vorbis_encode_setup_managed( &pv->vi, pv->out_discrete_channels,
- audio->config.out.samplerate, -1, 1000 * audio->config.out.bitrate, -1 ) )
+
+ if( audio->config.out.bitrate > 0 )
{
- hb_error( "encvorbis: vorbis_encode_setup_managed failed.\n" );
- *job->die = 1;
- return 0;
+ /* 28kbps/channel seems to be the minimum for 6ch vorbis. */
+ int min_bitrate = 28 * pv->out_discrete_channels;
+ if (pv->out_discrete_channels > 2 && audio->config.out.bitrate < min_bitrate)
+ {
+ hb_log( "encvorbis: Selected bitrate (%d kbps) too low for %d channel audio.", audio->config.out.bitrate, pv->out_discrete_channels);
+ hb_log( "encvorbis: Resetting bitrate to %d kbps", min_bitrate);
+ /* Naughty! We shouldn't modify the audio from here. */
+ audio->config.out.bitrate = min_bitrate;
+ }
+
+ if( vorbis_encode_setup_managed( &pv->vi, pv->out_discrete_channels,
+ audio->config.out.samplerate, -1, 1000 * audio->config.out.bitrate, -1 ) )
+ {
+ hb_error( "encvorbis: vorbis_encode_setup_managed failed.\n" );
+ *job->die = 1;
+ return 0;
+ }
+ }
+ else if( audio->config.out.quality >= 0 )
+ {
+ if( vorbis_encode_setup_vbr( &pv->vi, pv->out_discrete_channels,
+ audio->config.out.samplerate, audio->config.out.quality ) )
+ {
+ hb_error( "encvorbis: vorbis_encode_setup_vbr failed.\n" );
+ *job->die = 1;
+ return 0;
+ }
}
if( vorbis_encode_ctl( &pv->vi, OV_ECTL_RATEMANAGE2_SET, NULL ) ||