diff options
-rw-r--r-- | contrib/ffmpeg/A00-mov-utf16-chapters.patch | 25 | ||||
-rw-r--r-- | contrib/ffmpeg/module.defs | 2 | ||||
-rw-r--r-- | libhb/encac3.c | 11 | ||||
-rw-r--r-- | libhb/sync.c | 3 |
4 files changed, 10 insertions, 31 deletions
diff --git a/contrib/ffmpeg/A00-mov-utf16-chapters.patch b/contrib/ffmpeg/A00-mov-utf16-chapters.patch deleted file mode 100644 index 1dfde74e6..000000000 --- a/contrib/ffmpeg/A00-mov-utf16-chapters.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/libavformat/mov.c b/libavformat/mov.c -index 4370b48..b28c9ae 100644 ---- a/libavformat/mov.c -+++ b/libavformat/mov.c -@@ -2334,6 +2334,20 @@ static void mov_read_chapters(AVFormatContext *s) - av_freep(&title); - title = utf8; - } -+ else if (AV_RL16(title+2) == 0xfeff) { -+ uint8_t *utf8 = av_malloc(2*len+3); -+ -+ i8 = i16 = 0; -+ while (i16 < len) { -+ uint32_t ch; -+ uint8_t tmp; -+ GET_UTF16(ch, i16 < len ? AV_RL16(title + (i16+=2)) : 0, break;) -+ PUT_UTF8(ch, tmp, if (i8 < 2*len) utf8[2+i8++] = tmp;) -+ } -+ utf8[2+i8] = 0; -+ av_freep(&title); -+ title = utf8; -+ } - - ff_new_chapter(s, i, st->time_base, sample->timestamp, end, title+2); - av_freep(&title); diff --git a/contrib/ffmpeg/module.defs b/contrib/ffmpeg/module.defs index 304183ffe..bda0e8101 100644 --- a/contrib/ffmpeg/module.defs +++ b/contrib/ffmpeg/module.defs @@ -1,7 +1,7 @@ $(eval $(call import.MODULE.defs,FFMPEG,ffmpeg,BZIP2 FAAD2 ZLIB)) $(eval $(call import.CONTRIB.defs,FFMPEG)) -FFMPEG.FETCH.url = http://download.m0k.org/handbrake/contrib/ffmpeg-r25689.tar.bz2 +FFMPEG.FETCH.url = http://download.m0k.org/handbrake/contrib/ffmpeg-git-185a155.tar.bz2 FFMPEG.CONFIGURE.deps = FFMPEG.CONFIGURE.env = 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; diff --git a/libhb/sync.c b/libhb/sync.c index b44765e08..322dc783f 100644 --- a/libhb/sync.c +++ b/libhb/sync.c @@ -1154,6 +1154,7 @@ static void InitAudio( hb_job_t * job, hb_sync_common_t * common, int i ) c->bit_rate = w->audio->config.in.bitrate; c->sample_rate = w->audio->config.in.samplerate; c->channels = HB_INPUT_CH_LAYOUT_GET_DISCRETE_COUNT( w->audio->config.in.channel_layout ); + c->sample_fmt = AV_SAMPLE_FMT_FLT; if( hb_avcodec_open( c, codec ) < 0 ) { @@ -1162,7 +1163,7 @@ static void InitAudio( hb_job_t * job, hb_sync_common_t * common, int i ) } zeros = calloc( AC3_SAMPLES_PER_FRAME * - sizeof( short ) * c->channels, 1 ); + sizeof( float ) * c->channels, 1 ); sync->ac3_size = w->audio->config.in.bitrate * AC3_SAMPLES_PER_FRAME / w->audio->config.in.samplerate / 8; sync->ac3_buf = malloc( sync->ac3_size ); |