summaryrefslogtreecommitdiffstats
path: root/libhb/encvorbis.c
diff options
context:
space:
mode:
authormaurj <[email protected]>2007-04-11 15:23:57 +0000
committermaurj <[email protected]>2007-04-11 15:23:57 +0000
commitddc7ac09960746920ae8e48ac6f38a61c9f56d47 (patch)
tree0ad40c6da4ff1ef22f33f6b6543171f346643029 /libhb/encvorbis.c
parent1ce785c8d342834c33ee09e63315c5997782f919 (diff)
Added libhb and CLI support for Dolby Pro Logic II 5.0 matrix encoding. *NOT YET ADDED TO THE GUI*. Handbrake now uses a more general "audio mixdown" concept. For each audio track to be converted you specify a mixdown. These are defined in common.h.
This checkin only allows you to specify one mixdown for all tracks in the CLI, although everything is in place internally to specify a different mixdown per track. In the CLI, the "-6 --surround" option has been repurposed as a "-6 --mixdown" option, with a string parameter of mono/stereo/dpl1/dpl2/6ch. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@494 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/encvorbis.c')
-rw-r--r--libhb/encvorbis.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libhb/encvorbis.c b/libhb/encvorbis.c
index 169cb938f..df91e14e8 100644
--- a/libhb/encvorbis.c
+++ b/libhb/encvorbis.c
@@ -37,7 +37,7 @@ struct hb_work_private_s
uint64_t pts;
hb_list_t * list;
- int channelsused;
+ int out_discrete_channels;
int channel_map[6];
};
@@ -48,7 +48,7 @@ int encvorbisInit( hb_work_object_t * w, hb_job_t * job )
hb_work_private_t * pv = calloc( 1, sizeof( hb_work_private_t ) );
w->private_data = pv;
- pv->channelsused = w->config->vorbis.channelsused;
+ pv->out_discrete_channels = HB_AMIXDOWN_GET_DISCRETE_CHANNEL_COUNT(w->amixdown);
pv->job = job;
@@ -56,7 +56,7 @@ 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->channelsused,
+ 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 ) )
@@ -84,12 +84,12 @@ int encvorbisInit( hb_work_object_t * w, hb_job_t * job )
header[i].packet, header[i].bytes );
}
- pv->input_samples = pv->channelsused * OGGVORBIS_FRAME_SIZE;
+ pv->input_samples = pv->out_discrete_channels * OGGVORBIS_FRAME_SIZE;
pv->buf = malloc( pv->input_samples * sizeof( float ) );
pv->list = hb_list_init();
- switch (pv->channelsused) {
+ switch (pv->out_discrete_channels) {
case 1:
pv->channel_map[0] = 0;
break;
@@ -102,7 +102,7 @@ int encvorbisInit( hb_work_object_t * w, hb_job_t * job )
pv->channel_map[5] = 3;
break;
default:
- hb_log("encvorbis.c: Unable to correctly proccess %d channels, assuming stereo.", pv->channelsused);
+ hb_log("encvorbis.c: Unable to correctly proccess %d channels, assuming stereo.", pv->out_discrete_channels);
case 2:
// Assume stereo
pv->channel_map[0] = 0;
@@ -199,9 +199,9 @@ static hb_buffer_t * Encode( hb_work_object_t * w )
buffer = vorbis_analysis_buffer( &pv->vd, OGGVORBIS_FRAME_SIZE );
for( i = 0; i < OGGVORBIS_FRAME_SIZE; i++ )
{
- for( j = 0; j < pv->channelsused; j++)
+ for( j = 0; j < pv->out_discrete_channels; j++)
{
- buffer[j][i] = ((float *) pv->buf)[(pv->channelsused * i + pv->channel_map[j])] / 32768.f;
+ buffer[j][i] = ((float *) pv->buf)[(pv->out_discrete_channels * i + pv->channel_map[j])] / 32768.f;
}
}
vorbis_analysis_wrote( &pv->vd, OGGVORBIS_FRAME_SIZE );