diff options
author | jstebbins <[email protected]> | 2011-02-04 19:38:03 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2011-02-04 19:38:03 +0000 |
commit | 728d264fd8c930a61665839257b080784a6d186c (patch) | |
tree | f2a60feaa208274def692782da57dbc1b98bee5e /libhb/encac3.c | |
parent | dbd2efd6fdd65e09e31f53214e18b5b117fb2cc0 (diff) |
bump ffmpeg from svn 25689 to git 185a155
Fixes a couple h.264 decode issues
Fixes uft16-le chapter names in mov/mp4 files
Improved ac3 encoder
Numerous other bug fixes and improvements
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3779 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/encac3.c')
-rw-r--r-- | libhb/encac3.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/libhb/encac3.c b/libhb/encac3.c index 5c45b9800..179086607 100644 --- a/libhb/encac3.c +++ b/libhb/encac3.c @@ -18,7 +18,7 @@ struct hb_work_private_s unsigned long output_bytes; hb_list_t * list; uint8_t * buf; - int16_t * samples; + float * samples; }; int encac3Init( hb_work_object_t *, hb_job_t * ); @@ -53,7 +53,7 @@ int encac3Init( hb_work_object_t * w, hb_job_t * job ) pv->output_bytes = AC3_MAX_CODED_FRAME_SIZE; pv->buf = malloc( pv->input_samples * sizeof( float ) ); - pv->samples = malloc( pv->input_samples * sizeof( int16_t ) ); + pv->samples = malloc( pv->input_samples * sizeof( float ) ); codec = avcodec_find_encoder( CODEC_ID_AC3 ); if( !codec ) @@ -62,6 +62,7 @@ int encac3Init( hb_work_object_t * w, hb_job_t * job ) "failed" ); } context = avcodec_alloc_context(); + avcodec_get_context_defaults3(context, codec); context->channel_layout = CH_LAYOUT_STEREO; switch( audio->config.out.mixdown ) @@ -88,6 +89,7 @@ int encac3Init( hb_work_object_t * w, hb_job_t * job ) context->bit_rate = audio->config.out.bitrate * 1000; context->sample_rate = audio->config.out.samplerate; context->channels = pv->out_discrete_channels; + context->sample_fmt = AV_SAMPLE_FMT_FLT; if( hb_avcodec_open( context, codec ) ) { @@ -188,12 +190,13 @@ static hb_buffer_t * Encode( hb_work_object_t * w ) for (ii = 0; ii < pv->input_samples; ii++) { - pv->samples[ii] = (int16_t)((float*)pv->buf)[ii]; + // ffmpeg float samples are -1.0 to 1.0 + pv->samples[ii] = ((float*)pv->buf)[ii] / 32768.0; } buf = hb_buffer_init( pv->output_bytes ); buf->size = avcodec_encode_audio( pv->context, buf->data, buf->alloc, - pv->samples ); + (short*)pv->samples ); buf->start = pts + 90000 * pos / pv->out_discrete_channels / sizeof( float ) / audio->config.out.samplerate; buf->stop = buf->start + 90000 * AC3_SAMPLES_PER_FRAME / audio->config.out.samplerate; |