summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorsaintdev <[email protected]>2007-07-07 05:25:00 +0000
committersaintdev <[email protected]>2007-07-07 05:25:00 +0000
commita204a7468566e9aa0ce38c5b6bbf35d3b68cf398 (patch)
tree6d71f936ffdf0b5e07581c3e373073234ef4af5e /libhb
parent260622d9229cdde3bd9c70eb046330ac4a0e4f7e (diff)
vorbis: gracefully fail if encoder setup fails, and remove depriciated OV_ECTL_RATEMANAGE_AVG.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@656 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/encvorbis.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/libhb/encvorbis.c b/libhb/encvorbis.c
index f8aa365a9..5c919c6b0 100644
--- a/libhb/encvorbis.c
+++ b/libhb/encvorbis.c
@@ -45,6 +45,7 @@ int encvorbisInit( hb_work_object_t * w, hb_job_t * job )
{
int i;
ogg_packet header[3];
+ struct ovectl_ratemanage2_arg ctl_rate_arg;
hb_work_private_t * pv = calloc( 1, sizeof( hb_work_private_t ) );
w->private_data = pv;
@@ -57,11 +58,27 @@ int encvorbisInit( hb_work_object_t * w, hb_job_t * job )
/* init */
vorbis_info_init( &pv->vi );
if( vorbis_encode_setup_managed( &pv->vi, pv->out_discrete_channels,
- job->arate, -1, 1000 * job->abitrate, -1 ) ||
- vorbis_encode_ctl( &pv->vi, OV_ECTL_RATEMANAGE_AVG, NULL ) ||
- vorbis_encode_setup_init( &pv->vi ) )
+ job->arate, -1, 1000 * job->abitrate, -1 ) )
{
hb_log( "encvorbis: vorbis_encode_setup_managed failed" );
+ *job->die = 1;
+ return 0;
+ }
+
+ if( vorbis_encode_ctl( &pv->vi, OV_ECTL_RATEMANAGE2_GET, &ctl_rate_arg) )
+ {
+ hb_log( "encvorbis: vorbis_encode_ctl( ratemanage2_get ) failed" );
+ }
+
+ ctl_rate_arg.bitrate_average_kbps = 1000 * job->abitrate;
+ ctl_rate_arg.managed = 1;
+
+ if( vorbis_encode_ctl( &pv->vi, OV_ECTL_RATEMANAGE2_SET, &ctl_rate_arg ) ||
+ vorbis_encode_setup_init( &pv->vi ) )
+ {
+ hb_log( "encvorbis: vorbis_encode_ctl( ratemanage2_set ) OR vorbis_encode_setup_init failed" );
+ *job->die = 1;
+ return 0;
}
/* add a comment */