Commit e2b075ed authored by GitLab CI's avatar GitLab CI

Merge remote-tracking branch 'upstream/master' into master-build

* upstream/master:
  WinGui: Fix the .NET Framework version check in the installer.
  WinGui: Drop the .NET version back to 4.7.1 as 4.8 didn't resolve any issues and isn't as widespread deployed. Installer will still download 4.8 if a suitable version isn't installed.
  WinGui: UI Consistency Tweak on the video tab.
  nvenc: Change the rate control to vbr_hq, setting qmin/qmax  #2231
  WinGui: Metadata code cleanup
  WinGui: Update French, Chinese, German Translations.  Added Spanish and Russian as new supported languages.
  NVEnc: Check SDK version and disable feature if driver is too old.  Prevent re-checks by caching result.
  WinGui: Improvements to dropdown visibility behaviour on the Audio Defaults. #2135
  WinGui: Make the Dark Theme Windows 10 only.
  WinGui: Add Support for Subtitle Track Naming.  Auto-populate the Track name for both Audio/Subtitles if the source track has it available and we support reading it from that type of source file.  #855 #2213
  MacGui: fix some UI syncronization issues caused by moving things to another process.
  MacGui: fix the color of the selected queue row on 10.11.
  MacGui: enable and fix more warnings. Review nullability annotations.
  MacGui: do not copy the xpc info.plist to the Resources folder.
  MacGui: disable sudden termination in the xpc service when the core is created.
  libhb: eliminate file path length limits
  dvd: create track named from dvd track attributes
  ffmpeg: make track names visible regarless of locale
  stream: improve track name selection
  ffmpeg: add support to read/write mp4 'titl' track tag
  fix build error
  muxavformat: set handler_name for subtitle track names also
  muxavformat: fix writing alternative track name in mp4 hdlr atom
  CLI: add subtitle name support
  add subtitle name to job configuration log output
  add subtitle track name read/write
  a few fixes for audio track name handling
  ffmpeg: add 'name' track udta tag reading
  libhb: make source audio track name available to frontends
parents b2e4872c 5b3c3c62
From 375d09561cb88a7002a833614dbd399446479cd1 Mon Sep 17 00:00:00 2001
From: John Stebbins <jstebbins@jetheaddev.com>
Date: Wed, 31 Jul 2019 15:27:40 -0700
Subject: [PATCH 1/3] mov: read 'name' track tag written by movenc
---
libavformat/mov.c | 26 +++++++++++++++++---------
1 file changed, 17 insertions(+), 9 deletions(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 24de5429d1..1f933cccfd 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -306,6 +306,7 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
int (*parse)(MOVContext*, AVIOContext*, unsigned, const char*) = NULL;
int raw = 0;
int num = 0;
+ AVDictionary *metadata;
switch (atom.type) {
case MKTAG( '@','P','R','M'): key = "premiere_version"; raw = 1; break;
@@ -338,6 +339,7 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return mov_metadata_loci(c, pb, atom.size);
case MKTAG( 'm','a','n','u'): key = "make"; break;
case MKTAG( 'm','o','d','l'): key = "model"; break;
+ case MKTAG( 'n','a','m','e'): key = "title"; raw = 1; break;
case MKTAG( 'p','c','s','t'): key = "podcast";
parse = mov_metadata_int8_no_padding; break;
case MKTAG( 'p','g','a','p'): key = "gapless_playback";
@@ -514,17 +516,23 @@ retry:
}
str[str_size] = 0;
}
- c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
- av_dict_set(&c->fc->metadata, key, str, 0);
+ if (c->trak_index < 0) {
+ metadata = c->fc->metadata;
+ c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
+ if (!strcmp(key, "encoder")) {
+ int major, minor, micro;
+ if (sscanf(str, "HandBrake %d.%d.%d", &major, &minor, &micro) == 3) {
+ c->handbrake_version = 1000000*major + 1000*minor + micro;
+ }
+ }
+ }
+ else {
+ metadata = c->fc->streams[c->trak_index]->metadata;
+ }
+ av_dict_set(&metadata, key, str, 0);
if (*language && strcmp(language, "und")) {
snprintf(key2, sizeof(key2), "%s-%s", key, language);
- av_dict_set(&c->fc->metadata, key2, str, 0);
- }
- if (!strcmp(key, "encoder")) {
- int major, minor, micro;
- if (sscanf(str, "HandBrake %d.%d.%d", &major, &minor, &micro) == 3) {
- c->handbrake_version = 1000000*major + 1000*minor + micro;
- }
+ av_dict_set(&metadata, key2, str, 0);
}
}
--
2.21.0
From e9dde141a5fc27df87eb4b3454e34d725b211708 Mon Sep 17 00:00:00 2001
From: John Stebbins <jstebbins@jetheaddev.com>
Date: Sun, 4 Aug 2019 10:52:30 -0700
Subject: [PATCH 2/3] movenc: write 3gpp track 'titl' tag
Apple software used to use 'name' raw tag for track titles. When they
rewrote everything with AVFoundation, they switched to using 3gpp 'titl'
tag for track titles and 'name' no longer works.
---
libavformat/movenc.c | 78 +++++++++++++++++++++++---------------------
1 file changed, 40 insertions(+), 38 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index a96139077b..b1b6ef0e4e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3077,6 +3077,35 @@ static int mov_write_udta_sdp(AVIOContext *pb, MOVTrack *track)
return len + 24;
}
+static uint16_t language_code(const char *str)
+{
+ return (((str[0] - 0x60) & 0x1F) << 10) +
+ (((str[1] - 0x60) & 0x1F) << 5) +
+ (( str[2] - 0x60) & 0x1F);
+}
+
+static int mov_write_3gp_udta_tag(AVIOContext *pb, AVDictionary *metadata,
+ const char *tag, const char *str)
+{
+ int64_t pos = avio_tell(pb);
+ AVDictionaryEntry *t = av_dict_get(metadata, str, NULL, 0);
+ if (!t || !utf8len(t->value))
+ return 0;
+ avio_wb32(pb, 0); /* size */
+ ffio_wfourcc(pb, tag); /* type */
+ avio_wb32(pb, 0); /* version + flags */
+ if (!strcmp(tag, "yrrc"))
+ avio_wb16(pb, atoi(t->value));
+ else {
+ avio_wb16(pb, language_code("eng")); /* language */
+ avio_write(pb, t->value, strlen(t->value) + 1); /* UTF8 string value */
+ if (!strcmp(tag, "albm") &&
+ (t = av_dict_get(metadata, "track", NULL, 0)))
+ avio_w8(pb, atoi(t->value));
+ }
+ return update_size(pb, pos);
+}
+
static int mov_write_track_metadata(AVIOContext *pb, AVStream *st,
const char *tag, const char *str)
{
@@ -3105,8 +3134,10 @@ static int mov_write_track_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
if (ret < 0)
return ret;
- if (mov->mode & (MODE_MP4|MODE_MOV))
+ if (mov->mode & (MODE_MP4|MODE_MOV)) {
mov_write_track_metadata(pb_buf, st, "name", "title");
+ mov_write_3gp_udta_tag(pb_buf, st->metadata, "titl", "title");
+ }
if ((size = avio_close_dyn_buf(pb_buf, &buf)) > 0) {
avio_wb32(pb, size + 8);
@@ -3680,35 +3711,6 @@ static int ascii_to_wc(AVIOContext *pb, const uint8_t *b)
return 0;
}
-static uint16_t language_code(const char *str)
-{
- return (((str[0] - 0x60) & 0x1F) << 10) +
- (((str[1] - 0x60) & 0x1F) << 5) +
- (( str[2] - 0x60) & 0x1F);
-}
-
-static int mov_write_3gp_udta_tag(AVIOContext *pb, AVFormatContext *s,
- const char *tag, const char *str)
-{
- int64_t pos = avio_tell(pb);
- AVDictionaryEntry *t = av_dict_get(s->metadata, str, NULL, 0);
- if (!t || !utf8len(t->value))
- return 0;
- avio_wb32(pb, 0); /* size */
- ffio_wfourcc(pb, tag); /* type */
- avio_wb32(pb, 0); /* version + flags */
- if (!strcmp(tag, "yrrc"))
- avio_wb16(pb, atoi(t->value));
- else {
- avio_wb16(pb, language_code("eng")); /* language */
- avio_write(pb, t->value, strlen(t->value) + 1); /* UTF8 string value */
- if (!strcmp(tag, "albm") &&
- (t = av_dict_get(s->metadata, "track", NULL, 0)))
- avio_w8(pb, atoi(t->value));
- }
- return update_size(pb, pos);
-}
-
static int mov_write_chpl_tag(AVIOContext *pb, AVFormatContext *s)
{
int64_t pos = avio_tell(pb);
@@ -3747,14 +3749,14 @@ static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
return ret;
if (mov->mode & MODE_3GP) {
- mov_write_3gp_udta_tag(pb_buf, s, "perf", "artist");
- mov_write_3gp_udta_tag(pb_buf, s, "titl", "title");
- mov_write_3gp_udta_tag(pb_buf, s, "auth", "author");
- mov_write_3gp_udta_tag(pb_buf, s, "gnre", "genre");
- mov_write_3gp_udta_tag(pb_buf, s, "dscp", "comment");
- mov_write_3gp_udta_tag(pb_buf, s, "albm", "album");
- mov_write_3gp_udta_tag(pb_buf, s, "cprt", "copyright");
- mov_write_3gp_udta_tag(pb_buf, s, "yrrc", "date");
+ mov_write_3gp_udta_tag(pb_buf, s->metadata, "perf", "artist");
+ mov_write_3gp_udta_tag(pb_buf, s->metadata, "titl", "title");
+ mov_write_3gp_udta_tag(pb_buf, s->metadata, "auth", "author");
+ mov_write_3gp_udta_tag(pb_buf, s->metadata, "gnre", "genre");
+ mov_write_3gp_udta_tag(pb_buf, s->metadata, "dscp", "comment");
+ mov_write_3gp_udta_tag(pb_buf, s->metadata, "albm", "album");
+ mov_write_3gp_udta_tag(pb_buf, s->metadata, "cprt", "copyright");
+ mov_write_3gp_udta_tag(pb_buf, s->metadata, "yrrc", "date");
mov_write_loci_tag(s, pb_buf);
} else if (mov->mode == MODE_MOV && !(mov->flags & FF_MOV_FLAG_USE_MDTA)) { // the title field breaks gtkpod with mp4 and my suspicion is that stuff is not valid in mp4
mov_write_string_metadata(s, pb_buf, "\251ART", "artist", 0);
--
2.21.0
From 1b02b0afe201cd14a97d83dc08716bf9cc188cb0 Mon Sep 17 00:00:00 2001
From: John Stebbins <jstebbins@jetheaddev.com>
Date: Sun, 4 Aug 2019 10:59:38 -0700
Subject: [PATCH 3/3] mov: read 3gpp udta tags
---
libavformat/mov.c | 110 ++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 107 insertions(+), 3 deletions(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1f933cccfd..0c365cde3e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -50,6 +50,7 @@
#include "libavcodec/flac.h"
#include "libavcodec/mpegaudiodecheader.h"
#include "avformat.h"
+#include "avlanguage.h"
#include "internal.h"
#include "avio_internal.h"
#include "riff.h"
@@ -295,6 +296,82 @@ static int mov_metadata_hmmt(MOVContext *c, AVIOContext *pb, unsigned len)
return 0;
}
+static int mov_read_3gp_udta_tag(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+ const char *key;
+ AVDictionary *metadata;
+ uint16_t langcode = 0;
+ char key2[32], language[4] = {0};
+ uint32_t str_size, version;
+ char *str;
+
+ if (atom.size < 6)
+ return AVERROR_INVALIDDATA;
+
+ switch (atom.type) {
+ case MKTAG( 'a','l','b','m'): key = "album"; break;
+ case MKTAG( 'a','u','t','h'): key = "author"; break;
+ case MKTAG( 'c','p','r','t'): key = "copyright"; break;
+ case MKTAG( 'd','s','c','p'): key = "comment"; break;
+ case MKTAG( 'g','n','r','e'): key = "genre"; break;
+ case MKTAG( 'p','e','r','f'): key = "artist"; break;
+ case MKTAG( 't','i','t','l'): key = "title"; break;
+ case MKTAG( 'y','r','r','c'): key = "date"; break;
+ default: return 0;
+ }
+
+ version = avio_rb32(pb); // version + flags
+ if (version != 0)
+ return AVERROR_INVALIDDATA;
+
+ if (MKTAG( 'y','r','r','c') == atom.type) {
+ int year;
+ year = avio_rb16(pb);
+ str = av_asprintf("%d", year);
+ if (!str)
+ return AVERROR(ENOMEM);
+ } else {
+ int ret;
+ const char *tmp;
+ langcode = avio_rb16(pb);
+ ff_mov_lang_to_iso639(langcode, language);
+ tmp = ff_convert_lang_to(language, AV_LANG_ISO639_2_BIBL);
+ if (!tmp)
+ return AVERROR_INVALIDDATA;
+
+ str_size = atom.size - 6;
+ if (str_size <= 0 || str_size >= INT_MAX/2)
+ return AVERROR_INVALIDDATA;
+
+ str = av_mallocz(str_size + 1);
+ if (!str)
+ return AVERROR(ENOMEM);
+
+ ret = ffio_read_size(pb, str, str_size);
+ if (ret < 0) {
+ av_free(str);
+ return ret;
+ }
+ str[str_size] = 0;
+ }
+
+ if (c->trak_index < 0) {
+ metadata = c->fc->metadata;
+ c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED;
+ }
+ else {
+ metadata = c->fc->streams[c->trak_index]->metadata;
+ }
+ av_dict_set(&metadata, key, str, 0);
+ if (*language && strcmp(language, "und")) {
+ snprintf(key2, sizeof(key2), "%s-%s", key, language);
+ av_dict_set(&metadata, key2, str, 0);
+ }
+
+ av_freep(&str);
+ return 0;
+}
+
static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
char tmp_key[5];
@@ -320,15 +397,33 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
case MKTAG( 'c','a','t','g'): key = "category"; break;
case MKTAG( 'c','p','i','l'): key = "compilation";
parse = mov_metadata_int8_no_padding; break;
- case MKTAG( 'c','p','r','t'): key = "copyright"; break;
+ case MKTAG( 'c','p','r','t'):
+ key = "copyright";
+ if (!c->itunes_metadata) {
+ int64_t pos = avio_tell(pb);
+ int ret = mov_read_3gp_udta_tag(c, pb, atom);
+ if (ret != AVERROR_INVALIDDATA)
+ return ret;
+ avio_seek(pb, pos, SEEK_SET);
+ }
+ break;
case MKTAG( 'd','e','s','c'): key = "description"; break;
case MKTAG( 'd','i','s','k'): key = "disc";
parse = mov_metadata_track_or_disc_number; break;
case MKTAG( 'e','g','i','d'): key = "episode_uid";
parse = mov_metadata_int8_no_padding; break;
case MKTAG( 'F','I','R','M'): key = "firmware"; raw = 1; break;
- case MKTAG( 'g','n','r','e'): key = "genre";
- parse = mov_metadata_gnre; break;
+ case MKTAG( 'g','n','r','e'):
+ key = "genre";
+ parse = mov_metadata_gnre;
+ if (!c->itunes_metadata) {
+ int64_t pos = avio_tell(pb);
+ int ret = mov_read_3gp_udta_tag(c, pb, atom);
+ if (ret != AVERROR_INVALIDDATA)
+ return ret;
+ avio_seek(pb, pos, SEEK_SET);
+ }
+ break;
case MKTAG( 'h','d','v','d'): key = "hd_video";
parse = mov_metadata_int8_no_padding; break;
case MKTAG( 'H','M','M','T'):
@@ -399,6 +494,15 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
case MKTAG(0xa9,'w','r','n'): key = "warning"; break;
case MKTAG(0xa9,'w','r','t'): key = "composer"; break;
case MKTAG(0xa9,'x','y','z'): key = "location"; break;
+ case MKTAG( 'a','l','b','m'):
+ case MKTAG( 'a','u','t','h'):
+ case MKTAG( 'd','s','c','p'):
+ case MKTAG( 'p','e','r','f'):
+ case MKTAG( 't','i','t','l'):
+ case MKTAG( 'y','r','r','c'):
+ if (!c->itunes_metadata) {
+ return mov_read_3gp_udta_tag(c, pb, atom);
+ }
}
retry:
if (c->itunes_metadata && atom.size > 8) {
--
2.21.0
From defbe24539ad6e2564db84641a84543256f8609f Mon Sep 17 00:00:00 2001
From: John Stebbins <jstebbins@jetheaddev.com>
Date: Tue, 6 Aug 2019 11:45:11 -0600
Subject: [PATCH] movenc: write 3gpp track names tags for all available
languages
Metadata keys can have a language suffix. Iterate through all language
variations of the metadata key.
---
libavformat/movenc.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index b1b6ef0e4e..3d9800d386 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -26,6 +26,7 @@
#include "movenc.h"
#include "avformat.h"
+#include "avlanguage.h"
#include "avio_internal.h"
#include "riff.h"
#include "avio.h"
@@ -3089,15 +3090,25 @@ static int mov_write_3gp_udta_tag(AVIOContext *pb, AVDictionary *metadata,
{
int64_t pos = avio_tell(pb);
AVDictionaryEntry *t = av_dict_get(metadata, str, NULL, 0);
+
if (!t || !utf8len(t->value))
return 0;
+
avio_wb32(pb, 0); /* size */
ffio_wfourcc(pb, tag); /* type */
avio_wb32(pb, 0); /* version + flags */
if (!strcmp(tag, "yrrc"))
avio_wb16(pb, atoi(t->value));
else {
- avio_wb16(pb, language_code("eng")); /* language */
+ int lang = 0, len;
+ len = strlen(t->key);
+ if (t->key[len - 4] == '-') {
+ lang = ff_mov_iso639_to_lang(&t->key[len - 3], 1);
+ }
+ if (!lang)
+ lang = ff_mov_iso639_to_lang("und", 1);
+
+ avio_wb16(pb, lang); /* language */
avio_write(pb, t->value, strlen(t->value) + 1); /* UTF8 string value */
if (!strcmp(tag, "albm") &&
(t = av_dict_get(metadata, "track", NULL, 0)))
@@ -3135,8 +3146,21 @@ static int mov_write_track_udta_tag(AVIOContext *pb, MOVMuxContext *mov,
return ret;
if (mov->mode & (MODE_MP4|MODE_MOV)) {
+ AVDictionaryEntry *t = NULL;
+ int und = 0;
+
mov_write_track_metadata(pb_buf, st, "name", "title");
- mov_write_3gp_udta_tag(pb_buf, st->metadata, "titl", "title");
+ while ((t = av_dict_get(st->metadata, "title-", t, AV_DICT_IGNORE_SUFFIX))) {
+ int len = strlen(t->key);
+ if (len == 10 &&
+ ff_convert_lang_to(&t->key[len - 3], AV_LANG_ISO639_2_BIBL)) {
+ mov_write_3gp_udta_tag(pb_buf, st->metadata, "titl", t->key);
+ if (!strcmp("und", &t->key[len - 3]))
+ und = 1;
+ }
+ }
+ if (!und)
+ mov_write_3gp_udta_tag(pb_buf, st->metadata, "titl", "title");
}
if ((size = avio_close_dyn_buf(pb_buf, &buf)) > 0) {
--
2.21.0
......@@ -27,6 +27,7 @@
#include "hb.h"
#include "settings.h"
#include "jobdict.h"
#include "titledict.h"
#include "hb-backend.h"
#include "values.h"
#include "callbacks.h"
......@@ -61,6 +62,7 @@ ghb_sanitize_audio_settings(GhbValue *settings, GhbValue *asettings)
// Sanitize codec
const char * mux_name;
int title_id, mux, acodec, fallback, copy_mask, track;
uint32_t in_codec = 0;
hb_audio_config_t * aconfig;
const hb_title_t * title;
......@@ -75,7 +77,11 @@ ghb_sanitize_audio_settings(GhbValue *settings, GhbValue *asettings)
copy_mask = ghb_get_copy_mask(settings);
track = ghb_dict_get_int(asettings, "Track");
aconfig = ghb_get_audio_info(title, track);
acodec = ghb_select_audio_codec(mux, aconfig, acodec,
if (aconfig != NULL)
{
in_codec = aconfig->in.codec;
}
acodec = ghb_select_audio_codec(mux, in_codec, acodec,
fallback, copy_mask);
ghb_dict_set_string(asettings, "Encoder",
hb_audio_encoder_get_short_name(acodec));
......@@ -115,25 +121,24 @@ ghb_adjust_audio_rate_combos(signal_user_data_t *ud, GhbValue *asettings)
{
ghb_sanitize_audio_settings(ud->settings, asettings);
int track, title_id, mix, acodec;
const hb_title_t *title;
hb_audio_config_t *aconfig;
int track, mix, acodec;
GhbValue * atrack;
uint64_t layout;
title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, NULL);
track = ghb_dict_get_int(asettings, "Track");
aconfig = ghb_get_audio_info(title, track);
acodec = ghb_settings_audio_encoder_codec(asettings, "Encoder");
mix = ghb_settings_mixdown_mix(asettings, "Mixdown");
int low, high, sr;
sr = ghb_dict_get_int(asettings, "Samplerate");
if (sr == 0 && aconfig != NULL)
atrack = ghb_get_title_audio_track(ud->settings, track);
if (sr == 0)
{
sr = aconfig->in.samplerate;
sr = ghb_dict_get_int(atrack, "SampleRate");
}
mix = ghb_get_best_mix(aconfig, acodec, mix);
layout = ghb_dict_get_int(atrack, "ChannelLayout");
mix = ghb_get_best_mix(layout, acodec, mix);
hb_audio_bitrate_get_limits(acodec, sr, mix, &low, &high);
GtkWidget *w = GHB_WIDGET(ud->builder, "AudioBitrate");
......@@ -260,10 +265,8 @@ audio_deps(signal_user_data_t *ud, GhbValue *asettings, GtkWidget *widget)
}
gint
ghb_select_audio_codec(gint mux, hb_audio_config_t *aconfig, gint acodec, gint fallback, gint copy_mask)
ghb_select_audio_codec(gint mux, guint32 in_codec, gint acodec, gint fallback, gint copy_mask)
{
guint32 in_codec = aconfig != NULL ? aconfig->in.codec : 0;
if (acodec == HB_ACODEC_AUTO_PASS)
{
return hb_autopassthru_get_encoder(in_codec, copy_mask, fallback, mux);
......@@ -509,7 +512,6 @@ ghb_get_user_audio_lang(GhbValue *settings, const hb_title_t *title, gint track)
static GhbValue*
audio_add_track(
GhbValue *settings,
const hb_title_t *title,
int track,
int encoder,
gdouble quality,
......@@ -520,9 +522,8 @@ audio_add_track(
gdouble gain)
{
GhbValue *asettings;
hb_audio_config_t *aconfig = NULL;
GhbValue *atrack;
aconfig = ghb_get_audio_info(title, track);
asettings = ghb_dict_new();
ghb_dict_set_int(asettings, "Track", track);
......@@ -532,9 +533,16 @@ audio_add_track(
ghb_dict_set_int(asettings, "Bitrate", bitrate);
ghb_dict_set_int(asettings, "Samplerate", samplerate);
if (aconfig != NULL)
atrack = ghb_get_title_audio_track(settings, track);
if (atrack != NULL)
{
mix = ghb_get_best_mix(aconfig, encoder, mix);
int layout = ghb_dict_get_int(atrack, "ChannelLayout");
const char * name = ghb_dict_get_string(atrack, "Name");
mix = ghb_get_best_mix(layout, encoder, mix);
if (name != NULL)
{
ghb_dict_set_string(asettings, "Name", name);
}
}
ghb_dict_set_string(asettings, "Mixdown", hb_mixdown_get_short_name(mix));
ghb_dict_set_double(asettings, "DRC", drc);
......@@ -602,9 +610,9 @@ audio_select_and_add_track(
hb_audio_config_t *aconfig;
aconfig = hb_list_audio_config_item(title->list_audio, track);
select_acodec = ghb_select_audio_codec(
mux->format, aconfig, acodec, fallback, copy_mask);
mux->format, aconfig->in.codec, acodec, fallback, copy_mask);
asettings = audio_add_track(settings, title, track, select_acodec,
asettings = audio_add_track(settings, track, select_acodec,
quality, bitrate,
samplerate, mix, drc, gain);
}
......@@ -978,14 +986,10 @@ audio_codec_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
{
// Transition from passthru to not, put some audio settings back to
// pref settings
int title_id;
const hb_title_t *title;
gint titleindex;
gint track;
gint br, sr, mix;
title_id = ghb_dict_get_int(ud->settings, "title");
title = ghb_lookup_title(title_id, &titleindex);
uint64_t layout;
GhbValue * atrack;
if (asettings != NULL)
{
......@@ -1008,13 +1012,13 @@ audio_codec_changed_cb(GtkWidget *widget, signal_user_data_t *ud)
ghb_ui_update(ud, "AudioSamplerate",
ghb_string_value(ghb_audio_samplerate_get_short_name(sr)));
hb_audio_config_t *aconfig;
aconfig = ghb_get_audio_info(title, track);
atrack = ghb_get_title_audio_track(ud->settings, track);
if (sr == 0)
{
sr = aconfig ? aconfig->in.samplerate : 48000;
sr = ghb_dict_get_int(atrack, "SampleRate");
}
mix = ghb_get_best_mix( aconfig, acodec, mix);
layout = ghb_dict_get_int(atrack, "ChannelLayout");
mix = ghb_get_best_mix(layout, acodec, mix);
br = hb_audio_bitrate_get_best(acodec, br, sr, mix);
ghb_ui_update(ud, "AudioBitrate",
ghb_string_value(ghb_audio_bitrate_get_short_name(br)));
......
......@@ -33,7 +33,7 @@ GhbValue *ghb_get_audio_list(GhbValue *settings);
void ghb_sanitize_audio_track_settings(GhbValue *settings);
const gchar* ghb_get_user_audio_lang(GhbValue *settings, const hb_title_t *title, gint track);
void ghb_audio_list_refresh_selected(signal_user_data_t *ud);
gint ghb_select_audio_codec(gint mux, hb_audio_config_t *aconfig, gint acodec, gint fallback_acodec, gint copy_mask);
gint ghb_select_audio_codec(gint mux, guint32 in_codec, gint acodec, gint fallback_acodec, gint copy_mask);
int ghb_select_fallback( GhbValue *settings, int acodec );
int ghb_get_copy_mask(GhbValue *settings);
void ghb_audio_list_refresh_all(signal_user_data_t *ud);
......
......@@ -2628,11 +2628,13 @@ ghb_set_title_settings(signal_user_data_t *ud, GhbValue *settings)
ghb_subtitle_set_pref_lang(settings);
if (title != NULL)
{
GhbValue *job_dict;
GhbValue * job_dict, * title_dict;
char * label;
job_dict = hb_preset_job_init(ghb_scan_handle(), title_id, settings);
ghb_dict_set(settings, "Job", job_dict);
title_dict = hb_title_to_dict(ghb_scan_handle(), title_id);
ghb_dict_set(settings, "Title", title_dict);
gint num_chapters = hb_list_count(title->list_chapter);
......@@ -2763,6 +2765,9 @@ load_all_titles(signal_user_data_t *ud, int titleindex)
settings_array = ghb_array_new();
// Start with a clean job
ghb_dict_remove(ud->settings, "Job");
preset = ghb_get_current_preset(ud);
if (preset != NULL)
{
......
This diff is collapsed.
This diff is collapsed.
......@@ -1268,19 +1268,17 @@ ghb_grey_combo_options(signal_user_data_t *ud)
acodec = ghb_settings_audio_encoder_codec(ud->settings, "AudioEncoder");
gint64 layout = aconfig != NULL ? aconfig->in.channel_layout : ~0;
guint32 in_codec = aconfig != NULL ? aconfig->in.codec : 0;
fallback = ghb_select_fallback(ud->settings, acodec);
gint copy_mask = ghb_get_copy_mask(ud->settings);
acodec = ghb_select_audio_codec(mux->format, aconfig, acodec,
acodec = ghb_select_audio_codec(mux->format, in_codec, acodec,
fallback, copy_mask);
grey_mix_opts(ud, acodec, layout);
}
gint
ghb_get_best_mix(hb_audio_config_t *aconfig, gint acodec, gint mix)
ghb_get_best_mix(uint64_t layout, gint acodec, gint mix)
{
gint layout;
layout = aconfig ? aconfig->in.channel_layout : AV_CH_LAYOUT_5POINT1;
if (mix == HB_AMIXDOWN_NONE)
mix = HB_INVALID_AMIXDOWN;
......
......@@ -133,7 +133,7 @@ gint64 ghb_get_chapter_duration(const hb_title_t *title, gint chap);
gint64 ghb_get_chapter_start(const hb_title_t *title, gint chap);
gint64 ghb_chapter_range_get_duration(const hb_title_t *title,
gint sc, gint ec);
gint ghb_get_best_mix(hb_audio_config_t *aconfig, gint acodec, gint mix);
gint ghb_get_best_mix(uint64_t layout, gint acodec, gint mix);
gboolean ghb_audio_is_passthru(gint acodec);
gboolean ghb_audio_can_passthru