summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRodeo <[email protected]>2013-05-17 19:29:53 +0000
committerRodeo <[email protected]>2013-05-17 19:29:53 +0000
commitde0d1eab9d902081c0cece457a72256c3806b464 (patch)
tree52402f7bcad359d90d20472eb5d9ed60a0942e2c
parent08a5ee8d578dadb232d3648d828e277440ef9b85 (diff)
OpenCL: merge latest fixes from trunk.
git-svn-id: svn://svn.handbrake.fr/HandBrake/branches/opencl@5464 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--NEWS2
-rw-r--r--contrib/ffmpeg/A01-h264-recovery-point.patch4
-rw-r--r--contrib/ffmpeg/P01-solaris.patch4
-rw-r--r--contrib/ffmpeg/P02-darwin-pic.patch6
-rw-r--r--contrib/ffmpeg/module.defs2
-rw-r--r--contrib/libbluray/A01-filter-dup.patch80
-rw-r--r--contrib/x264/A00-version-string.patch23
-rw-r--r--gtk/src/audiohandler.c2
-rw-r--r--gtk/src/callbacks.c5
-rw-r--r--gtk/src/preview.c4
-rw-r--r--gtk/src/preview.h2
-rw-r--r--libhb/common.c6
-rw-r--r--libhb/decavcodec.c83
-rw-r--r--libhb/decsrtsub.c54
-rw-r--r--libhb/muxmkv.c1
-rw-r--r--libhb/scan.c1
-rw-r--r--libhb/stream.c122
-rw-r--r--libhb/sync.c82
-rw-r--r--macosx/ChapterTitles.h6
-rw-r--r--macosx/ChapterTitles.m89
-rw-r--r--macosx/Controller.m89
-rw-r--r--macosx/HBAudioController.m32
-rw-r--r--macosx/HBSubtitles.m8
-rw-r--r--make/configure.py2
-rw-r--r--test/test.c90
25 files changed, 473 insertions, 326 deletions
diff --git a/NEWS b/NEWS
index 219a77a50..dc8139f99 100644
--- a/NEWS
+++ b/NEWS
@@ -36,7 +36,7 @@ Changes betwen 0.9.8 and 0.9.9:
- Assorted bug fixes and improvements to the core library (libhb)
- Updated libraries
+ x264 r2273-b3065e6
- + Libav v9.3
+ + Libav v9.6
+ libbluray 0.2.3
Windows
- User Interface has been re-written in WPF
diff --git a/contrib/ffmpeg/A01-h264-recovery-point.patch b/contrib/ffmpeg/A01-h264-recovery-point.patch
index b9c29dc3a..353f18e9f 100644
--- a/contrib/ffmpeg/A01-h264-recovery-point.patch
+++ b/contrib/ffmpeg/A01-h264-recovery-point.patch
@@ -1,5 +1,5 @@
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
-index 54f6186..2647d5d 100644
+index 8625b0f..e862701 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2164,6 +2164,7 @@ static void flush_dpb(AVCodecContext *avctx)
@@ -10,7 +10,7 @@ index 54f6186..2647d5d 100644
}
static int init_poc(H264Context *h)
-@@ -3995,9 +3996,18 @@ again:
+@@ -4001,9 +4002,18 @@ again:
if ((err = decode_slice_header(hx, h)))
break;
diff --git a/contrib/ffmpeg/P01-solaris.patch b/contrib/ffmpeg/P01-solaris.patch
index 29633e323..399aabc3a 100644
--- a/contrib/ffmpeg/P01-solaris.patch
+++ b/contrib/ffmpeg/P01-solaris.patch
@@ -1,8 +1,8 @@
diff --git a/configure b/configure
-index aa31ea0..773e6bf 100755
+index 6ab04ae..1c8ab46 100755
--- a/configure
+++ b/configure
-@@ -3167,7 +3167,7 @@ EOF
+@@ -3171,7 +3171,7 @@ EOF
check_cc <<EOF || die "endian test failed"
unsigned int endian = 'B' << 24 | 'I' << 16 | 'G' << 8 | 'E';
EOF
diff --git a/contrib/ffmpeg/P02-darwin-pic.patch b/contrib/ffmpeg/P02-darwin-pic.patch
index b3f883eae..f512416a1 100644
--- a/contrib/ffmpeg/P02-darwin-pic.patch
+++ b/contrib/ffmpeg/P02-darwin-pic.patch
@@ -1,8 +1,8 @@
diff --git a/configure b/configure
-index aa31ea0..a7f5380 100755
+index 6ab04ae..fa9f980 100755
--- a/configure
+++ b/configure
-@@ -2889,6 +2889,7 @@ case $target_os in
+@@ -2893,6 +2893,7 @@ case $target_os in
AVSERVERLDFLAGS=-Wl,-bind_at_load
objformat="macho"
enabled x86_64 && objformat="macho64"
@@ -10,7 +10,7 @@ index aa31ea0..a7f5380 100755
enabled_any pic shared ||
{ check_cflags -mdynamic-no-pic && add_asflags -mdynamic-no-pic; }
;;
-@@ -3091,7 +3092,7 @@ esc(){
+@@ -3095,7 +3096,7 @@ esc(){
echo "config:$arch:$subarch:$cpu:$target_os:$(esc $cc_ident):$(esc $LIBAV_CONFIGURATION)" >config.fate
diff --git a/contrib/ffmpeg/module.defs b/contrib/ffmpeg/module.defs
index e30b1bcc5..70982af11 100644
--- a/contrib/ffmpeg/module.defs
+++ b/contrib/ffmpeg/module.defs
@@ -1,7 +1,7 @@
$(eval $(call import.MODULE.defs,FFMPEG,ffmpeg,YASM BZIP2 ZLIB FDKAAC))
$(eval $(call import.CONTRIB.defs,FFMPEG))
-FFMPEG.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libav-v9.3.tar.bz2
+FFMPEG.FETCH.url = http://download.handbrake.fr/handbrake/contrib/libav-v9.6.tar.bz2
FFMPEG.CONFIGURE.deps =
FFMPEG.CONFIGURE.env =
diff --git a/contrib/libbluray/A01-filter-dup.patch b/contrib/libbluray/A01-filter-dup.patch
new file mode 100644
index 000000000..608f8dd1b
--- /dev/null
+++ b/contrib/libbluray/A01-filter-dup.patch
@@ -0,0 +1,80 @@
+diff --git a/src/libbluray/bdnav/navigation.c b/src/libbluray/bdnav/navigation.c
+index c8dc307..26d0000 100644
+--- a/src/libbluray/bdnav/navigation.c
++++ b/src/libbluray/bdnav/navigation.c
+@@ -32,9 +32,25 @@
+ #include <stdlib.h>
+ #include <string.h>
+
++static int _stream_cmp(MPLS_STREAM *a, MPLS_STREAM *b)
++{
++ if (a->stream_type == b->stream_type &&
++ a->coding_type == b->coding_type &&
++ a->pid == b->pid &&
++ a->subpath_id == b->subpath_id &&
++ a->subclip_id == b->subclip_id &&
++ a->format == b->format &&
++ a->rate == b->rate &&
++ a->char_code == b->char_code &&
++ memcmp(a->lang, b->lang, 4) == 0) {
++ return 1;
++ }
++ return 0;
++}
++
+ static int _filter_dup(MPLS_PL *pl_list[], unsigned count, MPLS_PL *pl)
+ {
+- unsigned ii, jj;
++ unsigned ii, jj, kk;
+
+ for (ii = 0; ii < count; ii++) {
+ if (pl->list_count != pl_list[ii]->list_count) {
+@@ -54,7 +70,48 @@ static int _filter_dup(MPLS_PL *pl_list[], unsigned count, MPLS_PL *pl)
+ pi1->out_time != pi2->out_time) {
+ break;
+ }
++ if (pi1->stn.num_video != pi2->stn.num_video ||
++ pi1->stn.num_audio != pi2->stn.num_audio ||
++ pi1->stn.num_pg != pi2->stn.num_pg ||
++ pi1->stn.num_ig != pi2->stn.num_ig ||
++ pi1->stn.num_secondary_audio != pi2->stn.num_secondary_audio ||
++ pi1->stn.num_secondary_video != pi2->stn.num_secondary_video) {
++ break;
++ }
++ for (kk = 0; kk < pi1->stn.num_video; kk++) {
++ if (!_stream_cmp(&pi1->stn.video[kk], &pi2->stn.video[kk])) {
++ goto next;
++ }
++ }
++ for (kk = 0; kk < pi1->stn.num_audio; kk++) {
++ if (!_stream_cmp(&pi1->stn.audio[kk], &pi2->stn.audio[kk])) {
++ goto next;
++ }
++ }
++ for (kk = 0; kk < pi1->stn.num_pg; kk++) {
++ if (!_stream_cmp(&pi1->stn.pg[kk], &pi2->stn.pg[kk])) {
++ goto next;
++ }
++ }
++ for (kk = 0; kk < pi1->stn.num_ig; kk++) {
++ if (!_stream_cmp(&pi1->stn.ig[kk], &pi2->stn.ig[kk])) {
++ goto next;
++ }
++ }
++ for (kk = 0; kk < pi1->stn.num_secondary_audio; kk++) {
++ if (!_stream_cmp(&pi1->stn.secondary_audio[kk],
++ &pi2->stn.secondary_audio[kk])) {
++ goto next;
++ }
++ }
++ for (kk = 0; kk < pi1->stn.num_secondary_video; kk++) {
++ if (!_stream_cmp(&pi1->stn.secondary_video[kk],
++ &pi2->stn.secondary_video[kk])) {
++ goto next;
++ }
++ }
+ }
++next:
+ if (jj != pl->list_count) {
+ continue;
+ }
diff --git a/contrib/x264/A00-version-string.patch b/contrib/x264/A00-version-string.patch
new file mode 100644
index 000000000..dcd4ec628
--- /dev/null
+++ b/contrib/x264/A00-version-string.patch
@@ -0,0 +1,23 @@
+diff --git a/x264.h b/x264.h
+index e5a1600..f635d9e 100644
+--- a/x264.h
++++ b/x264.h
+@@ -41,7 +41,17 @@
+
+ #include "x264_config.h"
+
+-#define X264_BUILD 130
++/*
++ * Define the full version explicitly so that it survives a git --archive.
++ *
++ * Patch will break every time X264_BUILD changes, so that we don't forget to
++ * update it ;-)
++ */
++#ifdef X264_VERSION
++#undef X264_VERSION
++#endif
++#define X264_BUILD 130
++#define X264_VERSION " r2273 b3065e6"
+
+ /* Application developers planning to link against a shared library version of
+ * libx264 from a Microsoft Visual Studio or similar development environment
diff --git a/gtk/src/audiohandler.c b/gtk/src/audiohandler.c
index e09e7fcbf..2a7b619e4 100644
--- a/gtk/src/audiohandler.c
+++ b/gtk/src/audiohandler.c
@@ -1084,6 +1084,8 @@ audio_list_selection_changed_cb(GtkTreeSelection *selection, signal_user_data_t
block_updates = FALSE;
widget = GHB_WIDGET (ud->builder, "audio_remove");
gtk_widget_set_sensitive(widget, TRUE);
+
+ ghb_adjust_audio_rate_combos(ud);
}
else
{
diff --git a/gtk/src/callbacks.c b/gtk/src/callbacks.c
index 3b9edea12..e6b4714cb 100644
--- a/gtk/src/callbacks.c
+++ b/gtk/src/callbacks.c
@@ -1563,6 +1563,11 @@ set_title_settings(GValue *settings, gint titleindex)
hb_title_t * title = ghb_get_title_info(titleindex);
if (title != NULL)
{
+ gint num_chapters = hb_list_count(title->list_chapter);
+
+ ghb_settings_set_int(settings, "PtoPType", 0);
+ ghb_settings_set_int(settings, "start_point", 1);
+ ghb_settings_set_int(settings, "end_point", num_chapters);
ghb_settings_set_int(settings, "source_width", title->width);
ghb_settings_set_int(settings, "source_height", title->height);
ghb_settings_set_string(settings, "source", title->path);
diff --git a/gtk/src/preview.c b/gtk/src/preview.c
index d62026e7c..126943a54 100644
--- a/gtk/src/preview.c
+++ b/gtk/src/preview.c
@@ -62,7 +62,7 @@ struct preview_s
gint frame;
gint state;
gboolean pause;
- gboolean encoded[30];
+ gboolean encoded[GHB_PREVIEW_MAX];
gint encode_frame;
gint live_id;
gchar *current;
@@ -733,7 +733,7 @@ ghb_live_reset(signal_user_data_t *ud)
ud->preview->current = NULL;
}
encoded = ud->preview->encoded[ud->preview->frame];
- memset(ud->preview->encoded, 0, sizeof(gboolean) * 10);
+ memset(ud->preview->encoded, 0, sizeof(gboolean) * GHB_PREVIEW_MAX);
if (encoded)
ghb_set_preview_image(ud);
}
diff --git a/gtk/src/preview.h b/gtk/src/preview.h
index 089d60d1c..56d62415b 100644
--- a/gtk/src/preview.h
+++ b/gtk/src/preview.h
@@ -16,6 +16,8 @@
#if !defined(_GHB_PREVIEW_H_)
#define _GHB_PREVIEW_H_
+#define GHB_PREVIEW_MAX 60
+
#define MOD_ROUND(v,m) ((m==1)?v:(m * ((v + (m>>1)) / m)))
#define MOD_DOWN(v,m) (m * (v / m))
#define MOD_UP(v,m) (m * ((v + m - 1) / m))
diff --git a/libhb/common.c b/libhb/common.c
index c23d4f648..8f62970f7 100644
--- a/libhb/common.c
+++ b/libhb/common.c
@@ -994,12 +994,12 @@ int hb_get_best_mixdown(uint32_t codec, uint64_t layout, int mixdown)
// caller requested the best available mixdown
if (mixdown == HB_INVALID_AMIXDOWN)
- mixdown = hb_audio_mixdowns[hb_audio_mixdowns_count].amixdown;
+ mixdown = hb_audio_mixdowns[hb_audio_mixdowns_count - 1].amixdown;
int ii;
// test all mixdowns until an authorized, supported mixdown is found
// stop before we reach the "worst" non-None mixdown (index == 1)
- for (ii = hb_audio_mixdowns_count; ii > 1; ii--)
+ for (ii = hb_audio_mixdowns_count - 1; ii > 1; ii--)
if (hb_audio_mixdowns[ii].amixdown <= mixdown &&
hb_mixdown_is_supported(hb_audio_mixdowns[ii].amixdown, codec, layout))
break;
@@ -2398,7 +2398,7 @@ int hb_audio_add(const hb_job_t * job, const hb_audio_config_t * audiocfg)
audio->config.out.normalize_mix_level = 0;
audio->config.out.compression_level = -1;
audio->config.out.quality = HB_INVALID_AUDIO_QUALITY;
- audio->config.out.dither_method = AV_RESAMPLE_DITHER_NONE;
+ audio->config.out.dither_method = hb_audio_dither_get_default();
}
else
{
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c
index ad867ff29..409039e81 100644
--- a/libhb/decavcodec.c
+++ b/libhb/decavcodec.c
@@ -193,12 +193,21 @@ static int decavcodecaInit( hb_work_object_t * w, hb_job_t * job )
pv->title = w->title;
pv->list = hb_list_init();
- codec = avcodec_find_decoder(w->codec_param);
+ codec = avcodec_find_decoder(w->codec_param);
pv->context = avcodec_alloc_context3(codec);
+
if (pv->title->opaque_priv != NULL)
{
AVFormatContext *ic = (AVFormatContext*)pv->title->opaque_priv;
avcodec_copy_context(pv->context, ic->streams[w->audio->id]->codec);
+ // libav's eac3 parser toggles the codec_id in the context as
+ // it reads eac3 data between AV_CODEC_ID_AC3 and AV_CODEC_ID_EAC3.
+ // It detects an AC3 sync pattern sometimes in ac3_sync() which
+ // causes it to eventually set avctx->codec_id to AV_CODEC_ID_AC3
+ // in ff_aac_ac3_parse(). Since we are parsing some data before
+ // we get here, the codec_id may have flipped. This will cause an
+ // error in hb_avcodec_open(). So flip it back!
+ pv->context->codec_id = w->codec_param;
}
else
{
@@ -451,8 +460,27 @@ static int decavcodecaBSInfo( hb_work_object_t *w, const hb_buffer_t *buf,
static char codec_name[64];
info->name = strncpy( codec_name, codec->name, sizeof(codec_name)-1 );
- AVCodecParserContext *parser = av_parser_init( codec->id );
- AVCodecContext *context = avcodec_alloc_context3(codec);
+ AVCodecContext *context = avcodec_alloc_context3(codec);
+ AVCodecParserContext *parser = NULL;
+
+ if (w->title->opaque_priv != NULL)
+ {
+ AVFormatContext *ic = (AVFormatContext*)w->title->opaque_priv;
+ avcodec_copy_context(context, ic->streams[w->audio->id]->codec);
+ // libav's eac3 parser toggles the codec_id in the context as
+ // it reads eac3 data between AV_CODEC_ID_AC3 and AV_CODEC_ID_EAC3.
+ // It detects an AC3 sync pattern sometimes in ac3_sync() which
+ // causes it to eventually set avctx->codec_id to AV_CODEC_ID_AC3
+ // in ff_aac_ac3_parse(). Since we are parsing some data before
+ // we get here, the codec_id may have flipped. This will cause an
+ // error in hb_avcodec_open(). So flip it back!
+ context->codec_id = w->codec_param;
+ }
+ else
+ {
+ parser = av_parser_init(codec->id);
+ }
+
hb_ff_set_sample_fmt( context, codec, AV_SAMPLE_FMT_FLT );
if ( hb_avcodec_open( context, codec, NULL, 0 ) )
{
@@ -473,20 +501,6 @@ static int decavcodecaBSInfo( hb_work_object_t *w, const hb_buffer_t *buf,
len = av_parser_parse2(parser, context, &pbuffer, &pbuffer_size,
buf->data + pos, buf->size - pos,
buf->s.start, buf->s.start, 0);
- if (context->codec_id == AV_CODEC_ID_TRUEHD &&
- context->channel_layout == AV_CH_LAYOUT_MONO)
- {
- // libavcodec can't decode TrueHD Mono (bug #356)
- // work around it by requesting Stereo before decoding
- truehd_mono = 1;
- context->request_channels = 2;
- context->request_channel_layout = AV_CH_LAYOUT_STEREO;
- }
- else
- {
- context->request_channels = 0;
- context->request_channel_layout = 0;
- }
}
else
{
@@ -494,6 +508,22 @@ static int decavcodecaBSInfo( hb_work_object_t *w, const hb_buffer_t *buf,
len = pbuffer_size = buf->size;
}
pos += len;
+
+ // libavcodec can't decode TrueHD Mono (bug #356)
+ // work around it by requesting Stereo before decoding
+ if (context->codec_id == AV_CODEC_ID_TRUEHD &&
+ context->channel_layout == AV_CH_LAYOUT_MONO)
+ {
+ truehd_mono = 1;
+ context->request_channels = 2;
+ context->request_channel_layout = AV_CH_LAYOUT_STEREO;
+ }
+ else
+ {
+ context->request_channels = 0;
+ context->request_channel_layout = 0;
+ }
+
if (pbuffer_size > 0)
{
int got_frame;
@@ -508,8 +538,24 @@ static int decavcodecaBSInfo( hb_work_object_t *w, const hb_buffer_t *buf,
{
info->rate_base = 1;
info->rate = context->sample_rate;
- info->bitrate = context->bit_rate;
info->samples_per_frame = frame.nb_samples;
+
+ int bps = av_get_bits_per_sample(context->codec_id);
+ if (bps > 0 && context->channels > 0)
+ {
+ info->bitrate = (bps *
+ context->channels *
+ context->sample_rate);
+ }
+ else if (context->bit_rate > 0)
+ {
+ info->bitrate = context->bit_rate;
+ }
+ else
+ {
+ info->bitrate = 1;
+ }
+
if (truehd_mono)
{
info->channel_layout = AV_CH_LAYOUT_MONO;
@@ -520,6 +566,7 @@ static int decavcodecaBSInfo( hb_work_object_t *w, const hb_buffer_t *buf,
hb_ff_layout_xlat(context->channel_layout,
context->channels);
}
+
ret = 1;
break;
}
diff --git a/libhb/decsrtsub.c b/libhb/decsrtsub.c
index 9bc9cedcd..74377552e 100644
--- a/libhb/decsrtsub.c
+++ b/libhb/decsrtsub.c
@@ -166,6 +166,9 @@ static int get_line( hb_work_private_t * pv, char *buf, int size )
int i;
char c;
+ // clear remnants of the previous line before progessing a new one
+ memset(buf, '\0', size);
+
/* Find newline in converted UTF-8 buffer */
for( i = 0; i < size - 1; i++ )
{
@@ -321,7 +324,7 @@ static hb_buffer_t *srt_read( hb_work_private_t *pv )
*/
pv->last_entry_number = entry_number;
resync = 0;
- if( *pv->current_entry.text )
+ if (*pv->current_entry.text != '\0')
{
long length;
char *p, *q;
@@ -342,30 +345,36 @@ static hb_buffer_t *srt_read( hb_work_private_t *pv )
length = strlen( pv->current_entry.text );
- for( q = p = pv->current_entry.text; *p; p++)
+ for (q = p = pv->current_entry.text; *p != '\0'; p++)
{
- if( *p == '\n' )
+ if (*p == '\n' || *p == '\r')
{
- if ( line == 1 )
+ if (*(p + 1) == '\n' || *(p + 1) == '\r' ||
+ *(p + 1) == '\0')
+ {
+ // followed by line break or last character, skip it
+ length--;
+ continue;
+ }
+ else if (line == 1)
{
- *q = *p;
+ // replace '\r' with '\n'
+ *q = '\n';
line = 2;
}
else
{
+ // all subtitles on two lines tops
+ // replace line breaks with spaces
*q = ' ';
}
q++;
}
- else if( *p != '\r' )
+ else
{
*q = *p;
q++;
}
- else
- {
- length--;
- }
}
*q = '\0';
@@ -392,7 +401,7 @@ static hb_buffer_t *srt_read( hb_work_private_t *pv )
}
hb_buffer_t *buffer = NULL;
- if( *pv->current_entry.text )
+ if (*pv->current_entry.text != '\0')
{
long length;
char *p, *q;
@@ -411,30 +420,35 @@ static hb_buffer_t *srt_read( hb_work_private_t *pv )
length = strlen( pv->current_entry.text );
- for( q = p = pv->current_entry.text; *p; p++)
+ for (q = p = pv->current_entry.text; *p != '\0'; p++)
{
- if( *p == '\n' )
+ if (*p == '\n' || *p == '\r')
{
- if ( line == 1 )
+ if (*(p + 1) == '\n' || *(p + 1) == '\r' || *(p + 1) == '\0')
{
- *q = *p;
+ // followed by line break or last character, skip it
+ length--;
+ continue;
+ }
+ else if (line == 1)
+ {
+ // replace '\r' with '\n'
+ *q = '\n';
line = 2;
}
else
{
+ // all subtitles on two lines tops
+ // replace line breaks with spaces
*q = ' ';
}
q++;
}
- else if( *p != '\r' )
+ else
{
*q = *p;
q++;
}
- else
- {
- length--;
- }
}
*q = '\0';
diff --git a/libhb/muxmkv.c b/libhb/muxmkv.c
index 8a14168c1..a170eb557 100644
--- a/libhb/muxmkv.c
+++ b/libhb/muxmkv.c
@@ -652,6 +652,7 @@ static int MKVEnd(hb_mux_object_t *m)
switch (audio->config.out.codec & HB_ACODEC_MASK)
{
case HB_ACODEC_FFFLAC:
+ case HB_ACODEC_FFFLAC24:
if( audio->priv.config.extradata.bytes )
{
uint8_t *header;
diff --git a/libhb/scan.c b/libhb/scan.c
index 40dffa01e..c83326d4d 100644
--- a/libhb/scan.c
+++ b/libhb/scan.c
@@ -1000,6 +1000,7 @@ static void LookForAudio( hb_title_t * title, hb_buffer_t * b )
}
hb_work_info_t info;
+ w->title = title;
w->audio = audio;
w->codec_param = audio->config.in.codec_param;
b = hb_fifo_see( audio->priv.scan_cache );
diff --git a/libhb/stream.c b/libhb/stream.c
index 816ef29f4..3512b2d93 100644
--- a/libhb/stream.c
+++ b/libhb/stream.c
@@ -5144,87 +5144,65 @@ static void ffmpeg_close( hb_stream_t *d )
static void add_ffmpeg_audio(hb_title_t *title, hb_stream_t *stream, int id)
{
- AVStream *st = stream->ffmpeg_ic->streams[id];
- AVCodecContext *codec = st->codec;
- AVDictionaryEntry *tag;
-
- // scan will ignore any audio without a bitrate. Since we've already typed the
- // audio in order to determine its codec we set up the audio parameters here.
- if (codec->bit_rate || codec->sample_rate)
- {
- hb_audio_t *audio = calloc(1, sizeof(*audio));
- audio->id = id;
+ AVStream *st = stream->ffmpeg_ic->streams[id];
+ AVCodecContext *codec = st->codec;
+ AVDictionaryEntry *tag = av_dict_get(st->metadata, "language", NULL, 0);
+
+ hb_audio_t *audio = calloc(1, sizeof(*audio));
+ audio->id = id;
+ audio->config.in.track = id;
+ audio->config.in.codec = HB_ACODEC_FFMPEG;
+ audio->config.in.codec_param = codec->codec_id;
+ // set the bitrate to 0; decavcodecaBSInfo will be called and fill the rest
+ audio->config.in.bitrate = 0;
+
+ // set the input codec and extradata for Passthru
+ switch (codec->codec_id)
+ {
+ case AV_CODEC_ID_AAC:
+ {
+ int len = MIN(codec->extradata_size, HB_CONFIG_MAX_SIZE);
+ memcpy(audio->priv.config.extradata.bytes, codec->extradata, len);
+ audio->priv.config.extradata.length = len;
+ audio->config.in.codec = HB_ACODEC_FFAAC;
+ } break;
+
+ case AV_CODEC_ID_AC3:
+ audio->config.in.codec = HB_ACODEC_AC3;
+ audio->config.in.codec_param = 0;
+ break;
- if (codec->codec_id == AV_CODEC_ID_AC3)
+ case AV_CODEC_ID_DTS:
{
- audio->config.in.codec = HB_ACODEC_AC3;
- }
- else
- {
- if (codec->codec_id == AV_CODEC_ID_DTS)
+ switch (codec->profile)
{
- if (codec->profile == FF_PROFILE_DTS_HD_MA ||
- codec->profile == FF_PROFILE_DTS_HD_HRA)
- {
- audio->config.in.codec = HB_ACODEC_DCA_HD;
- }
- else if (codec->profile == FF_PROFILE_DTS ||
- codec->profile == FF_PROFILE_DTS_ES ||
- codec->profile == FF_PROFILE_DTS_96_24)
- {
+ case FF_PROFILE_DTS:
+ case FF_PROFILE_DTS_ES:
+ case FF_PROFILE_DTS_96_24:
audio->config.in.codec = HB_ACODEC_DCA;
- }
- else
- {
- audio->config.in.codec = HB_ACODEC_FFMPEG;
- }
- }
- else if (codec->codec_id == AV_CODEC_ID_AAC)
- {
- int len = MIN(codec->extradata_size, HB_CONFIG_MAX_SIZE);
- memcpy(audio->priv.config.extradata.bytes, codec->extradata,
- len);
- audio->priv.config.extradata.length = len;
- audio->config.in.codec = HB_ACODEC_FFAAC;
- }
- else if (codec->codec_id == AV_CODEC_ID_MP3)
- {
- audio->config.in.codec = HB_ACODEC_MP3;
- }
- else
- {
- audio->config.in.codec = HB_ACODEC_FFMPEG;
- }
- audio->config.in.codec_param = codec->codec_id;
+ break;
- int bps = av_get_bits_per_sample(codec->codec_id);
- if (bps && codec->sample_rate && codec->channels)
- {
- audio->config.in.bitrate = (codec->channels *
- codec->sample_rate * bps);
- }
- else if (codec->bit_rate)
- {
- audio->config.in.bitrate = codec->bit_rate;
- }
- else
- {
- audio->config.in.bitrate = 1;
+ case FF_PROFILE_DTS_HD_MA:
+ case FF_PROFILE_DTS_HD_HRA:
+ audio->config.in.codec = HB_ACODEC_DCA_HD;
+ break;
+
+ default:
+ break;
}
- audio->config.in.samplerate = codec->sample_rate;
- audio->config.in.samples_per_frame = codec->frame_size;
- audio->config.in.channel_map = &hb_libav_chan_map;
- audio->config.in.channel_layout =
- hb_ff_layout_xlat(codec->channel_layout, codec->channels);
- }
+ } break;
- tag = av_dict_get(st->metadata, "language", NULL, 0);
- set_audio_description(stream, audio,
- lang_for_code2(tag ? tag->value : "und"));
+ case AV_CODEC_ID_MP3:
+ audio->config.in.codec = HB_ACODEC_MP3;
+ break;
- audio->config.in.track = id;
- hb_list_add(title->list_audio, audio);
+ default:
+ break;
}
+
+ set_audio_description(stream, audio,
+ lang_for_code2(tag != NULL ? tag->value : "und"));
+ hb_list_add(title->list_audio, audio);
}
/*
diff --git a/libhb/sync.c b/libhb/sync.c
index fe3d01915..3e88c40e5 100644
--- a/libhb/sync.c
+++ b/libhb/sync.c
@@ -368,6 +368,7 @@ int syncVideoWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
* Feed it downstream & signal that we're done.
*/
*buf_out = next;
+ sync->cur = NULL;
pv->common->start_found = 1;
pv->common->first_pts[0] = INT64_MAX - 1;
@@ -979,52 +980,55 @@ static void InitAudio( hb_job_t * job, hb_sync_common_t * common, int i )
c->channel_layout = w->audio->config.in.channel_layout;
}
- if( hb_avcodec_open( c, codec, NULL, 0 ) < 0 )
+ if (hb_avcodec_open(c, codec, NULL, 0) < 0)
{
- hb_log( "sync: avcodec_open failed" );
- return;
+ hb_log("sync: track %d, hb_avcodec_open() failed, dropping video to sync",
+ w->audio->config.out.track);
+ sync->drop_video_to_sync = 1;
}
-
- // Prepare input frame
- AVFrame frame = { .nb_samples = c->frame_size, .pts = 0, };
- int input_size = av_samples_get_buffer_size(NULL, c->channels,
- frame.nb_samples,
- c->sample_fmt, 1);
- uint8_t *zeros = calloc(1, input_size);
- avcodec_fill_audio_frame(&frame, c->channels, c->sample_fmt, zeros,
- input_size, 1);
-
- // Allocate enough space for the encoded silence
- // The output should be < the input
- sync->silence_buf = malloc( input_size );
-
- // There is some delay in getting output from some audio encoders.
- // So encode a few packets till we get output.
- int ii;
- for ( ii = 0; ii < 10; ii++ )
+ else
{
- // Prepare output packet
- AVPacket pkt;
- int got_packet;
- av_init_packet(&pkt);
- pkt.data = sync->silence_buf;
- pkt.size = input_size;
-
- int ret = avcodec_encode_audio2( c, &pkt, &frame, &got_packet);
- if ( ret < 0 )
+ // Prepare input frame
+ AVFrame frame = { .nb_samples = c->frame_size, .pts = 0, };
+ int input_size = av_samples_get_buffer_size(NULL, c->channels,
+ frame.nb_samples,
+ c->sample_fmt, 1);
+ uint8_t *zeros = calloc(1, input_size);
+ avcodec_fill_audio_frame(&frame, c->channels, c->sample_fmt, zeros,
+ input_size, 1);
+
+ // Allocate enough space for the encoded silence
+ // The output should be < the input
+ sync->silence_buf = malloc( input_size );
+
+ // There is some delay in getting output from some audio encoders.
+ // So encode a few packets till we get output.
+ int ii;
+ for ( ii = 0; ii < 10; ii++ )
{
- hb_log( "sync: avcodec_encode_audio failed" );
- break;
- }
+ // Prepare output packet
+ AVPacket pkt;
+ int got_packet;
+ av_init_packet(&pkt);
+ pkt.data = sync->silence_buf;
+ pkt.size = input_size;
+
+ int ret = avcodec_encode_audio2( c, &pkt, &frame, &got_packet);
+ if ( ret < 0 )
+ {
+ hb_log( "sync: avcodec_encode_audio failed" );
+ break;
+ }
- if ( got_packet )
- {
- sync->silence_size = pkt.size;
- break;
+ if ( got_packet )
+ {
+ sync->silence_size = pkt.size;
+ break;
+ }
}
+ free( zeros );
+ hb_avcodec_close( c );
}
- free( zeros );
- hb_avcodec_close( c );
av_free( c );
}
else
diff --git a/macosx/ChapterTitles.h b/macosx/ChapterTitles.h
index 94d06c806..4b6a3fb07 100644
--- a/macosx/ChapterTitles.h
+++ b/macosx/ChapterTitles.h
@@ -8,12 +8,16 @@
#include "hb.h"
@interface ChapterTitles : NSObject {
- hb_title_t *fTitle;
+ hb_title_t *fTitle;
+ NSMutableArray *fChapterTitlesArray;
}
// Trigger a refresh of data
- (void)resetWithTitle:(hb_title_t *)title;
+// Get the list of chapter titles
+- (NSArray*)chapterTitlesArray;
+
// Table View Delegates
- (int)numberOfRowsInTableView:(NSTableView *)aTableView;
diff --git a/macosx/ChapterTitles.m b/macosx/ChapterTitles.m
index 2fcd77272..d568af8a4 100644
--- a/macosx/ChapterTitles.m
+++ b/macosx/ChapterTitles.m
@@ -11,50 +11,62 @@
- (id)init
{
self = [super init];
- if( self != nil )
+ if (self != nil)
{
- fTitle = NULL;
+ fTitle = NULL;
+ fChapterTitlesArray = [[[NSMutableArray alloc] init] retain];
}
-
return self;
}
+- (void)dealloc
+{
+ [fChapterTitlesArray release];
+ [super dealloc];
+}
+
- (void)resetWithTitle:(hb_title_t *)title
{
- int i;
- NSString *chapterString;
-
fTitle = title;
+ [fChapterTitlesArray removeAllObjects];
- if (!title)
+ if (fTitle == NULL)
return;
- hb_job_t * job = title->job;
- int count = hb_list_count( job->list_chapter );
-
- for( i = 0; i < count; i++ )
+ for (int i = 0; i < hb_list_count(fTitle->job->list_chapter); i++)
{
- hb_chapter_t *chapter = hb_list_item( job->list_chapter, i );
-
- if( chapter != NULL && chapter->title == NULL )
+ hb_chapter_t *chapter = hb_list_item(fTitle->job->list_chapter, i);
+ if (chapter != NULL)
{
- chapterString = [NSString stringWithFormat:@"Chapter %2d",(i+1)];
-
- hb_chapter_set_title( chapter, [chapterString UTF8String]);
+ if (chapter->title != NULL)
+ {
+ [fChapterTitlesArray addObject:[NSString
+ stringWithUTF8String:chapter->title]];
+ }
+ else
+ {
+ [fChapterTitlesArray addObject:[NSString
+ stringWithFormat:@"Chapter %d",
+ i + 1]];
+ }
}
}
-
+}
+
+- (NSArray*)chapterTitlesArray
+{
+ return [NSArray arrayWithArray:fChapterTitlesArray];
}
- (int)numberOfRowsInTableView:(NSTableView *)aTableView
{
- if( fTitle == NULL )
+ if (fTitle == NULL)
{
return 0;
}
else
{
- return hb_list_count( fTitle->list_chapter );
+ return [fChapterTitlesArray count];
}
}
@@ -63,17 +75,12 @@
forTableColumn:(NSTableColumn *)aTableColumn
row:(NSInteger)rowIndex
{
- if(aTableColumn != nil && [[aTableColumn identifier] intValue] == 2)
+ if (aTableColumn != nil && [[aTableColumn identifier] intValue] == 2 &&
+ fTitle != NULL)
{
- if( fTitle )
- {
- hb_chapter_t *chapter = hb_list_item( fTitle->job->list_chapter, rowIndex );
-
- if( chapter != NULL )
- {
- hb_chapter_set_title( chapter, [anObject UTF8String]);
- }
- }
+ [fChapterTitlesArray replaceObjectAtIndex:rowIndex
+ withObject:[NSString
+ stringWithString:anObject]];
}
}
@@ -81,26 +88,16 @@
objectValueForTableColumn:(NSTableColumn *)aTableColumn
row:(NSInteger)rowIndex
{
- NSString *cellEntry = @"__DATA ERROR__";
-
- if([[aTableColumn identifier] intValue] == 1)
+ if ([[aTableColumn identifier] intValue] == 1)
{
- cellEntry = [NSString stringWithFormat:@"%d",rowIndex+1];
+ return [NSString stringWithFormat:@"%d", rowIndex + 1];
}
- else
+ else if (fTitle != NULL)
{
- if( fTitle )
- {
- hb_chapter_t *chapter = hb_list_item( fTitle->job->list_chapter, rowIndex );
-
- if( chapter != NULL )
- {
- cellEntry = [NSString stringWithUTF8String:chapter->title];
- }
- }
+ return [NSString stringWithString:[fChapterTitlesArray
+ objectAtIndex:rowIndex]];
}
-
- return cellEntry;
+ return @"__DATA ERROR__";
}
/* Method to edit the next chapter when the user presses Return. We have to use
diff --git a/macosx/Controller.m b/macosx/Controller.m
index a7184ed36..a71eb67cc 100644
--- a/macosx/Controller.m
+++ b/macosx/Controller.m
@@ -2566,19 +2566,7 @@ fWorkingCount = 0;
* in our queue, so they can be reapplied in prepareJob when this queue
* item comes up if Chapter Markers is set to on.
*/
- int i;
- NSMutableArray *ChapterNamesArray = [[NSMutableArray alloc] init];
- int chaptercount = hb_list_count( fTitle->job->list_chapter );
- for( i = 0; i < chaptercount; i++ )
- {
- hb_chapter_t *chapter = (hb_chapter_t *) hb_list_item( fTitle->job->list_chapter, i );
- if( chapter != NULL )
- {
- [ChapterNamesArray addObject:[NSString stringWithUTF8String:chapter->title]];
- }
- }
- [queueFileJob setObject:[NSMutableArray arrayWithArray: ChapterNamesArray] forKey:@"ChapterNames"];
- [ChapterNamesArray autorelease];
+ [queueFileJob setObject:[fChapterTitlesDelegate chapterTitlesArray] forKey:@"ChapterNames"];
/* Allow Mpeg4 64 bit formatting +4GB file sizes */
[queueFileJob setObject:[NSNumber numberWithInt:[fDstMp4LargeFileCheck state]] forKey:@"Mp4LargeFile"];
@@ -4155,27 +4143,31 @@ bool one_burned = FALSE;
/* Audio tracks and mixdowns */
/* Now lets add our new tracks to the audio list here */
- for (unsigned int counter = 0; counter < maximumNumberOfAllowedAudioTracks; counter++) {
- NSString *prefix = [NSString stringWithFormat: @"Audio%d", counter + 1];
- if ([[queueToApply objectForKey: [prefix stringByAppendingString: @"Track"]] intValue] > 0) {
- audio = (hb_audio_config_t *) calloc(1, sizeof(*audio));
- hb_audio_config_init(audio);
- audio->in.track = [[queueToApply objectForKey: [prefix stringByAppendingString: @"Track"]] intValue] - 1;
- /* We go ahead and assign values to our audio->out.<properties> */
- audio->out.track = audio->in.track;
- audio->out.dynamic_range_compression = [[queueToApply objectForKey: [prefix stringByAppendingString: @"TrackDRCSlider"]] floatValue];
- audio->out.gain = [[queueToApply objectForKey: [prefix stringByAppendingString: @"TrackGainSlider"]] floatValue];
- prefix = [NSString stringWithFormat: @"JobAudio%d", counter + 1];
- audio->out.codec = [[queueToApply objectForKey: [prefix stringByAppendingString: @"Encoder"]] intValue];
- audio->out.compression_level = hb_get_default_audio_compression(audio->out.codec);
- audio->out.mixdown = [[queueToApply objectForKey: [prefix stringByAppendingString: @"Mixdown"]] intValue];
- audio->out.bitrate = [[queueToApply objectForKey: [prefix stringByAppendingString: @"Bitrate"]] intValue];
- audio->out.samplerate = [[queueToApply objectForKey: [prefix stringByAppendingString: @"Samplerate"]] intValue];
-
- hb_audio_add( job, audio );
- free(audio);
- }
- }
+ for (unsigned int counter = 0; counter < maximumNumberOfAllowedAudioTracks; counter++)
+ {
+ NSString *prefix = [NSString stringWithFormat:@"Audio%d", counter + 1];
+ NSString *jobPrefix = [NSString stringWithFormat:@"JobAudio%d", counter + 1];
+ if ([[queueToApply objectForKey:[prefix stringByAppendingString:@"Track"]] intValue] > 0)
+ {
+ audio = (hb_audio_config_t*)calloc(1, sizeof(*audio));
+ hb_audio_config_init(audio);
+ audio->in.track = [[queueToApply objectForKey:[prefix stringByAppendingString:@"Track"]] intValue] - 1;
+ /* We go ahead and assign values to our audio->out.<properties> */
+ audio->out.track = audio->in.track;
+ audio->out.codec = [[queueToApply objectForKey:[jobPrefix stringByAppendingString:@"Encoder"]] intValue];
+ audio->out.compression_level = hb_get_default_audio_compression(audio->out.codec);
+ audio->out.mixdown = [[queueToApply objectForKey:[jobPrefix stringByAppendingString:@"Mixdown"]] intValue];
+ audio->out.normalize_mix_level = 0;
+ audio->out.bitrate = [[queueToApply objectForKey:[jobPrefix stringByAppendingString:@"Bitrate"]] intValue];
+ audio->out.samplerate = [[queueToApply objectForKey:[jobPrefix stringByAppendingString:@"Samplerate"]] intValue];
+ audio->out.dynamic_range_compression = [[queueToApply objectForKey:[prefix stringByAppendingString:@"TrackDRCSlider"]] floatValue];
+ audio->out.gain = [[queueToApply objectForKey:[prefix stringByAppendingString:@"TrackGainSlider"]] floatValue];
+ audio->out.dither_method = hb_audio_dither_get_default();
+
+ hb_audio_add(job, audio);
+ free(audio);
+ }
+ }
/* Now lets call the filters if applicable.
* The order of the filters is critical
@@ -4954,14 +4946,17 @@ bool one_burned = FALSE;
}
}
- /* if we have a previously selected vid encoder tag, then try to select it */
+ /*
+ * item 0 will be selected by default
+ * deselect it so that we can detect whether the video encoder has changed
+ */
+ [fVidEncoderPopUp selectItem:nil];
if (selectedVidEncoderTag)
{
- [fVidEncoderPopUp selectItemWithTag: selectedVidEncoderTag];
- }
- else
- {
- [fVidEncoderPopUp selectItemAtIndex: 0];
+ // if we have a tag for previously selected encoder, try to select it
+ // if this fails, [fVidEncoderPopUp selectedItem] will be nil
+ // we'll handle that scenario further down
+ [fVidEncoderPopUp selectItemWithTag:selectedVidEncoderTag];
}
/* Update the Auto Passtgru Fallback Codec Popup */
@@ -5031,22 +5026,16 @@ bool one_burned = FALSE;
else
[fDstFile2Field setStringValue: [NSString stringWithFormat:@"%@.%s", [string stringByDeletingPathExtension], ext]];
- if( SuccessfulScan )
+ if (SuccessfulScan)
{
- /* Add/replace to the correct extension */
-
- if( [fVidEncoderPopUp selectedItem] == nil )
+ if ([fVidEncoderPopUp selectedItem] == nil)
{
-
+ /* this means the above call to selectItemWithTag failed */
[fVidEncoderPopUp selectItemAtIndex:0];
[self videoEncoderPopUpChanged:nil];
-
- /* We call the method to properly enable/disable turbo 2 pass */
- [self twoPassCheckboxChanged: sender];
- /* We call method method to change UI to reflect whether a preset is used or not*/
}
}
- [self customSettingUsed: sender];
+ [self customSettingUsed:sender];
}
- (IBAction) autoSetM4vExtension: (id) sender
diff --git a/macosx/HBAudioController.m b/macosx/HBAudioController.m
index 5e4a32508..353e24f16 100644
--- a/macosx/HBAudioController.m
+++ b/macosx/HBAudioController.m
@@ -150,27 +150,27 @@ NSString *HBMixdownChangedNotification = @"HBMixdownChangedNotification";
unsigned int audioArrayCount = [self countOfAudioArray];
for (i = 0; i < audioArrayCount; i++)
{
- HBAudio *anAudio = [self objectInAudioArrayAtIndex: i];
+ HBAudio *anAudio = [self objectInAudioArrayAtIndex:i];
if ([anAudio enabled])
{
- NSNumber *sampleRateToUse = (0 == [[[anAudio sampleRate] objectForKey: keyAudioSamplerate] intValue]) ?
- [[anAudio track] objectForKey: keyAudioInputSampleRate] :
- [[anAudio sampleRate] objectForKey: keyAudioSamplerate];
+ NSNumber *sampleRateToUse = ([[[anAudio sampleRate] objectForKey:keyAudioSamplerate] intValue] == 0 ?
+ [[anAudio track] objectForKey:keyAudioInputSampleRate] :
+ [[anAudio sampleRate] objectForKey:keyAudioSamplerate]);
- hb_audio_config_t *audio = (hb_audio_config_t *) calloc(1, sizeof(*audio));
+ hb_audio_config_t *audio = (hb_audio_config_t*)calloc(1, sizeof(*audio));
hb_audio_config_init(audio);
- audio->in.track = [[[anAudio track] objectForKey: keyAudioTrackIndex] intValue] - 1;
+ audio->in.track = [[[anAudio track] objectForKey:keyAudioTrackIndex] intValue] - 1;
/* We go ahead and assign values to our audio->out.<properties> */
- audio->out.track = audio->in.track;
- audio->out.codec = [[[anAudio codec] objectForKey: keyAudioCodec] intValue];
- audio->out.compression_level = hb_get_default_audio_compression(audio->out.codec);
- audio->out.mixdown = [[[anAudio mixdown] objectForKey: keyAudioMixdown] intValue];
- audio->out.normalize_mix_level = 0;
- audio->out.bitrate = [[[anAudio bitRate] objectForKey: keyAudioBitrate] intValue];
- audio->out.samplerate = [sampleRateToUse intValue];
- audio->out.dynamic_range_compression = [[anAudio drc] floatValue];
- audio->out.gain = [[anAudio gain] floatValue];
- audio->out.dither_method = hb_audio_dither_get_default();
+ audio->out.track = audio->in.track;
+ audio->out.codec = [[[anAudio codec] objectForKey:keyAudioCodec] intValue];
+ audio->out.compression_level = hb_get_default_audio_compression(audio->out.codec);
+ audio->out.mixdown = [[[anAudio mixdown] objectForKey:keyAudioMixdown] intValue];
+ audio->out.normalize_mix_level = 0;
+ audio->out.bitrate = [[[anAudio bitRate] objectForKey:keyAudioBitrate] intValue];
+ audio->out.samplerate = [sampleRateToUse intValue];
+ audio->out.dynamic_range_compression = [[anAudio drc] floatValue];
+ audio->out.gain = [[anAudio gain] floatValue];
+ audio->out.dither_method = hb_audio_dither_get_default();
hb_audio_add(aJob, audio);
free(audio);
diff --git a/macosx/HBSubtitles.m b/macosx/HBSubtitles.m
index 94561a983..d8b4b6989 100644
--- a/macosx/HBSubtitles.m
+++ b/macosx/HBSubtitles.m
@@ -1009,8 +1009,9 @@
BOOL convertToBurnInUsed = NO;
NSMutableArray *tracksToDelete = [[NSMutableArray alloc] init];
NSEnumerator *enumerator = [subtitleArray objectEnumerator];
- /* convert any incompatible tracks to burn-in or remove them */
- while (tempObject = [enumerator nextObject])
+ /* convert any non-None incompatible tracks to burn-in or remove them */
+ while ((tempObject = [enumerator nextObject]) &&
+ [tempObject objectForKey:@"subtitleSourceTrackType"])
{
subtitleTrackType = [[tempObject objectForKey:@"subtitleSourceTrackType"] intValue];
if (!hb_subtitle_can_pass(subtitleTrackType, container))
@@ -1032,7 +1033,8 @@
if (convertToBurnInUsed == YES)
{
enumerator = [subtitleArray objectEnumerator];
- while (tempObject = [enumerator nextObject])
+ while ((tempObject = [enumerator nextObject]) &&
+ [tempObject objectForKey:@"subtitleSourceTrackType"])
{
subtitleTrackType = [[tempObject objectForKey:@"subtitleSourceTrackType"] intValue];
if (hb_subtitle_can_pass(subtitleTrackType, container))
diff --git a/make/configure.py b/make/configure.py
index 96d6a85cb..7c1ef868e 100644
--- a/make/configure.py
+++ b/make/configure.py
@@ -766,7 +766,7 @@ class Project( Action ):
self.vmajor = 0
self.vminor = 9
- self.vpoint = 6
+ self.vpoint = 9
def _action( self ):
## add architecture to URL only for Mac
diff --git a/test/test.c b/test/test.c
index a790c94d8..9cef85550 100644
--- a/test/test.c
+++ b/test/test.c
@@ -79,7 +79,6 @@ static char ** acompressions = NULL;
static char * acodec_fallback = NULL;
static char * acodecs = NULL;
static char ** anames = NULL;
-static int default_acodec = 0;
static int audio_explicit = 0;
static char ** subtracks = NULL;
static char ** subforce = NULL;
@@ -1796,6 +1795,27 @@ static int HandleEvents( hb_handle_t * h )
hb_add_filter( job, filter, filter_str );
free( filter_str );
+ // hb_job_init() will set a default muxer for us
+ // only override it if a specific muxer has been set
+ // note: the muxer must be set after presets, but before encoders
+ if (mux)
+ {
+ job->mux = mux;
+ }
+ // then, muxer options
+ if (largeFileSize)
+ {
+ job->largeFileSize = 1;
+ }
+ if (mp4_optimize)
+ {
+ job->mp4_optimize = 1;
+ }
+ if (ipod_atom)
+ {
+ job->ipod_atom = 1;
+ }
+
if( vquality >= 0.0 )
{
job->vquality = vquality;
@@ -1968,7 +1988,7 @@ static int HandleEvents( hb_handle_t * h )
if ((acodec = get_acodec_for_string(token)) == -1)
{
fprintf(stderr, "Invalid codec %s, using default for container.\n", token);
- acodec = default_acodec;
+ acodec = hb_get_default_audio_encoder(job->mux);
}
if( i < num_audio_tracks )
{
@@ -2006,7 +2026,7 @@ static int HandleEvents( hb_handle_t * h )
* then use that codec instead.
*/
if (i != 1)
- acodec = default_acodec;
+ acodec = hb_get_default_audio_encoder(job->mux);
for ( ; i < num_audio_tracks; i++)
{
audio = hb_list_audio_config_item(job->list_audio, i);
@@ -2685,24 +2705,6 @@ static int HandleEvents( hb_handle_t * h )
}
}
- if( job->mux )
- {
- job->mux = mux;
- }
-
- if ( largeFileSize )
- {
- job->largeFileSize = 1;
- }
- if ( mp4_optimize )
- {
- job->mp4_optimize = 1;
- }
- if ( ipod_atom )
- {
- job->ipod_atom = 1;
- }
-
hb_job_set_file( job, output );
if( color_matrix_code )
@@ -2929,7 +2931,6 @@ static void ShowHelp()
" double quotation marks\n"
" -z, --preset-list See a list of available built-in presets\n"
" --no-dvdnav Do not use dvdnav for reading DVDs\n"
- " (experimental, enabled by default for testing)\n"
" --no-opencl Disable use of OpenCL\n"
"\n"
@@ -2944,8 +2945,8 @@ static void ShowHelp()
" -c, --chapters <string> Select chapters (e.g. \"1-3\" for chapters\n"
" 1 to 3, or \"3\" for chapter 3 only,\n"
" default: all chapters)\n"
- " --angle <number> Select the DVD angle\n"
- " --previews <#:B> Select how many preview images are generated (max 30),\n"
+ " --angle <number> Select the video angle (DVD or Blu-ray only)\n"
+ " --previews <#:B> Select how many preview images are generated,\n"
" and whether or not they're stored to disk (0 or 1).\n"
" (default: 10:0)\n"
" --start-at-preview <#> Start encoding at a given preview.\n"
@@ -2959,10 +2960,10 @@ static void ShowHelp()
" -o, --output <string> Set output file name\n"
" -f, --format <string> Set output format (mp4/mkv, default:\n"
" autodetected from file name)\n"
- " -m, --markers Add chapter markers (mp4 and mkv output formats only)\n"
- " -4, --large-file Use 64-bit mp4 files that can hold more than\n"
- " 4 GB. Note: Breaks iPod, PS3 compatibility.\n"""
- " -O, --optimize Optimize mp4 files for HTTP streaming\n"
+ " -m, --markers Add chapter markers\n"
+ " -4, --large-file Create 64-bit mp4 files that can hold more than 4 GB\n"
+ " of data. Note: breaks pre-iOS iPod compatibility.\n"
+ " -O, --optimize Optimize mp4 files for HTTP streaming (\"fast start\")\n"
" -I, --ipod-atom Mark mp4 files so 5.5G iPods will accept them\n"
" -P, --opencl-support Use OpenCL\n"
" -U, --UVD-support Use UVD hardware\n"
@@ -3082,10 +3083,8 @@ static void ShowHelp()
" -q, --quality <number> Set video quality\n"
" -b, --vb <kb/s> Set video bitrate (default: 1000)\n"
" -2, --two-pass Use two-pass mode\n"
- " -T, --turbo When using 2-pass use the turbo options\n"
- " on the first pass to improve speed\n"
- " (only works with x264, affects PSNR by about 0.05dB,\n"
- " and increases first pass speed two to four times)\n"
+ " -T, --turbo When using 2-pass use \"turbo\" options on the\n"
+ " 1st pass to improve speed (only works with x264)\n"
" -r, --rate Set video framerate (" );
for( i = 0; i < hb_video_rates_count; i++ )
{
@@ -3237,14 +3236,14 @@ static void ShowHelp()
"\n"
"### Picture Settings---------------------------------------------------------\n\n"
- " -w, --width <number> Set picture width\n"
+ " -w, --width <number> Set picture width\n"
" -l, --height <number> Set picture height\n"
- " --crop <T:B:L:R> Set cropping values (default: autocrop)\n"
- " --loose-crop Always crop to a multiple of the modulus\n"
- " <#> Specifies the maximum number of extra pixels\n"
+ " --crop <T:B:L:R> Set cropping values (default: autocrop)\n"
+ " --loose-crop <#> Always crop to a multiple of the modulus\n"
+ " Specifies the maximum number of extra pixels\n"
" which may be cropped (default: 15)\n"
- " -Y, --maxHeight <#> Set maximum height\n"
- " -X, --maxWidth <#> Set maximum width\n"
+ " -Y, --maxHeight <#> Set maximum height\n"
+ " -X, --maxWidth <#> Set maximum width\n"
" --strict-anamorphic Store pixel aspect ratio in video stream\n"
" --loose-anamorphic Store pixel aspect ratio with specified width\n"
" --custom-anamorphic Store pixel aspect ratio in video stream and\n"
@@ -3269,7 +3268,7 @@ static void ShowHelp()
"### Filters---------------------------------------------------------\n\n"
- " -d, --deinterlace Deinterlace video with yadif/mcdeint filter\n"
+ " -d, --deinterlace Deinterlace video with Libav, yadif or mcdeint\n"
" <fast/slow/slower/bob> or omitted (default settings)\n"
" or\n"
" <YM:FD:MM:QP> (default 0:-1:-1:1)\n"
@@ -3282,7 +3281,7 @@ static void ShowHelp()
" Note: this filter drops duplicate frames to\n"
" restore the pre-telecine framerate, unless you\n"
" specify a constant framerate (--rate 29.97)\n"
- " <L:R:T:B:SB:MP:FD> (default 1:1:4:4:0:0:-1)\n"
+ " <L:R:T:B:SB:MP:FD> (default 1:1:4:4:0:0:-1)\n"
" -8, --denoise Denoise video with hqdn3d filter\n"
" <weak/medium/strong> or omitted (default settings)\n"
" or\n"
@@ -3338,14 +3337,14 @@ static void ShowHelp()
" subtitle track is used instead.\n"
" --srt-file <string> SubRip SRT filename(s), separated by commas.\n"
" --srt-codeset Character codeset(s) that the SRT file(s) are\n"
- " <string> encoded in, separted by commas.\n"
+ " <string> encoded in, separated by commas.\n"
" Use 'iconv -l' for a list of valid\n"
- " codesets. If not specified latin1 is assumed\n"
- " --srt-offset Offset in milli-seconds to apply to the SRT file(s)\n"
- " <string> separted by commas. If not specified zero is assumed.\n"
+ " codesets. If not specified, 'latin1' is assumed\n"
+ " --srt-offset Offset (in milliseconds) to apply to the SRT file(s),\n"
+ " <string> separated by commas. If not specified, zero is assumed.\n"
" Offsets may be negative.\n"
" --srt-lang <string> Language as an iso639-2 code fra, eng, spa et cetera)\n"
- " for the SRT file(s) separated by commas. If not specified\n"
+ " for the SRT file(s), separated by commas. If not specified,\n"
" then 'und' is used.\n"
" --srt-default Flag the selected srt as the default subtitle\n"
" <number> to be displayed upon playback. Setting no default\n"
@@ -4215,7 +4214,6 @@ static int CheckOptions( int argc, char ** argv )
"choices are mp4, m4v and mkv\n.", format );
return 1;
}
- default_acodec = hb_get_default_audio_encoder(mux);
}
return 0;