ghb_settings_set_int(subdict, "SubtitleTrack", -1);
ghb_settings_set_boolean(subdict, "SubtitleForced", FALSE);
ghb_settings_set_boolean(subdict, "SubtitleBurned", FALSE);
+ ghb_settings_set_boolean(subdict, "SubtitleDefaultTrack", FALSE);
ghb_settings_set_string(subdict, "SubtitleLanguage", "auto");
ghb_add_subtitle(ud, subdict, FALSE);
ghb_settings_set_int(subdict, "SubtitleTrack", ii);
ghb_settings_set_boolean(subdict, "SubtitleForced", FALSE);
ghb_settings_set_boolean(subdict, "SubtitleBurned", FALSE);
+ ghb_settings_set_boolean(subdict, "SubtitleDefaultTrack", FALSE);
ghb_settings_set_string(subdict, "SubtitleLanguage",
subtitle->iso639_2);
ghb_add_subtitle(ud, subdict, FALSE);
job->cfr = 1;
}
- // First remove any audios that are already in the list
- // This happens if you are encoding the same title a second time.
- gint num_audio_tracks = hb_list_count(job->list_audio);
- gint ii;
- for(ii = 0; ii < num_audio_tracks; ii++)
- {
- hb_audio_t *audio = (hb_audio_t*)hb_list_item(job->list_audio, 0);
- hb_list_rem(job->list_audio, audio);
- }
-
const GValue *audio_list;
- gint count;
+ gint count, ii;
gint tcount = 0;
audio_list = ghb_settings_get_value(js, "audio_list");
const GValue *subtitle_list;
gint subtitle;
+ job->select_subtitle = NULL;
subtitle_list = ghb_settings_get_value(js, "subtitle_list");
count = ghb_array_len(subtitle_list);
for (ii = 0; ii < count; ii++)
{
GValue *ssettings;
- gboolean burned, enabled, one_burned = FALSE;
+ gboolean enabled, force, burned, def, one_burned = FALSE;
ssettings = ghb_array_get_nth(subtitle_list, ii);
continue;
subtitle = ghb_settings_get_int(ssettings, "SubtitleTrack");
+ force = ghb_settings_get_boolean(ssettings, "SubtitleForced");
burned = ghb_settings_get_boolean(ssettings, "SubtitleBurned");
+ def = ghb_settings_get_boolean(ssettings, "SubtitleDefaultTrack");
if (subtitle == -1)
{
+ if (!burned && job->mux == HB_MUX_MKV)
+ {
+ job->select_subtitle_config.dest = PASSTHRUSUB;
+ }
+ else if (!burned && job->mux == HB_MUX_MP4)
+ {
+ // Skip any non-burned vobsubs when output is mp4
+ continue;
+ }
+ else
+ {
+ // Only allow one subtitle to be burned into the video
+ if (one_burned)
+ continue;
+ one_burned = TRUE;
+ }
+ job->select_subtitle_config.force = force;
+ job->select_subtitle_config.default_track = def;
job->indepth_scan = 1;
+ job->select_subtitle = malloc(sizeof(hb_subtitle_t*));
+ *job->select_subtitle = NULL;
}
else if (subtitle >= 0)
{
if (!burned && job->mux == HB_MUX_MKV &&
subt->format == PICTURESUB)
{
- subt->dest = PASSTHRUSUB;
+ subt->config.dest = PASSTHRUSUB;
}
else if (!burned && job->mux == HB_MUX_MP4 &&
subt->format == PICTURESUB)
continue;
one_burned = TRUE;
}
- subt->force = ghb_settings_get_boolean(ssettings, "SubtitleForced");
+ subt->config.force = force;
+ subt->config.default_track = def;
hb_list_add(job->list_subtitle, subt);
}
}
x264opts_tmp = job->x264opts;
job->x264opts = NULL;
- job->select_subtitle = malloc(sizeof(hb_subtitle_t*));
- *(job->select_subtitle) = NULL;
/*
* Add the pre-scan job
job->x264opts = x264opts_tmp;
}
- else
- {
- job->select_subtitle = NULL;
- }
+
if( ghb_settings_get_boolean(js, "VideoTwoPass") &&
!ghb_settings_get_boolean(js, "vquality_type_constant"))
{
//if (job->x264opts != NULL)
// g_free(job->x264opts);
}
+
+ // First remove any audios that are already in the list
+ // This happens if you are encoding the same title a second time.
+ gint num_audio_tracks = hb_list_count(job->list_audio);
+ for(ii = 0; ii < num_audio_tracks; ii++)
+ {
+ hb_audio_t *audio = (hb_audio_t*)hb_list_item(job->list_audio, 0);
+ hb_list_rem(job->list_audio, audio);
+ free(audio);
+ }
+
if (detel_str) g_free(detel_str);
if (decomb_str) g_free(decomb_str);
if (deint_str) g_free(deint_str);
<true />
<key>SubtitleBurned</key>
<true />
+ <key>SubtitleDefaultTrack</key>
+ <false />
</dict>
</array>
<key>VideoTurboTwoPass</key>
extern G_MODULE_EXPORT void subtitle_enable_toggled_cb(void);
extern G_MODULE_EXPORT void subtitle_forced_toggled_cb(void);
extern G_MODULE_EXPORT void subtitle_burned_toggled_cb(void);
+extern G_MODULE_EXPORT void subtitle_default_toggled_cb(void);
extern G_MODULE_EXPORT void subtitle_track_changed_cb(void);
// Create and bind the tree model to the tree view for the subtitle track list
selection = gtk_tree_view_get_selection (treeview);
// 6 columns in model. 4 are visible, the other 2 is for storing
// values that I need
- treestore = gtk_list_store_new(7,
+ // Enable, Track, force, burn, default, type, track short, can delete
+ treestore = gtk_list_store_new(8,
G_TYPE_BOOLEAN, G_TYPE_STRING,
G_TYPE_BOOLEAN, G_TYPE_BOOLEAN,
- G_TYPE_STRING, G_TYPE_STRING,
- G_TYPE_BOOLEAN);
+ G_TYPE_BOOLEAN, G_TYPE_STRING,
+ G_TYPE_STRING, G_TYPE_BOOLEAN);
gtk_tree_view_set_model(treeview, GTK_TREE_MODEL(treestore));
cell = gtk_cell_renderer_toggle_new();
column = gtk_tree_view_column_new_with_attributes(
- _("On"), cell, "active", 0, NULL);
+ _("Enable"), cell, "active", 0, NULL);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
g_signal_connect(cell, "toggled", subtitle_enable_toggled_cb, ud);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
g_signal_connect(cell, "toggled", subtitle_burned_toggled_cb, ud);
+ cell = gtk_cell_renderer_toggle_new();
+ gtk_cell_renderer_toggle_set_radio(GTK_CELL_RENDERER_TOGGLE(cell), TRUE);
+ column = gtk_tree_view_column_new_with_attributes(
+ _("Default"), cell, "active", 4, NULL);
+ gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
+ g_signal_connect(cell, "toggled", subtitle_default_toggled_cb, ud);
+
cell = gtk_cell_renderer_text_new();
column = gtk_tree_view_column_new_with_attributes(
- _("Type"), cell, "text", 4, NULL);
+ _("Type"), cell, "text", 5, NULL);
gtk_tree_view_append_column(treeview, GTK_TREE_VIEW_COLUMN(column));
}
ghb_dict_insert(sdict, g_strdup("SubtitleBurned"),
ghb_boolean_value_new(TRUE));
+ ghb_dict_insert(sdict, g_strdup("SubtitleDefaultTrack"),
+ ghb_boolean_value_new(FALSE));
}
else
{
}
}
+void
+ghb_subtitle_exclusive_default(signal_user_data_t *ud, gint track)
+{
+ GValue *subtitle_list;
+ GValue *settings;
+ gint ii, count, tt;
+ GtkTreeView *tv;
+ GtkTreeModel *tm;
+ GtkTreeIter ti;
+ gboolean def;
+
+ g_debug("ghb_subtitle_exclusive_default");
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ count = ghb_array_len(subtitle_list);
+ for (ii = 0; ii < count; ii++)
+ {
+ settings = ghb_array_get_nth(subtitle_list, ii);
+ tt = ghb_settings_combo_int(settings, "SubtitleTrack");
+ def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack");
+
+ tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
+ g_return_if_fail(tv != NULL);
+ tm = gtk_tree_view_get_model(tv);
+ gtk_tree_model_iter_nth_child(tm, &ti, NULL, ii);
+ if (def && tt != track)
+ {
+
+ ghb_settings_set_boolean(settings, "SubtitleDefaultTrack", FALSE);
+ def = FALSE;
+ gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 4, FALSE, -1);
+ }
+ }
+}
+
G_MODULE_EXPORT void
subtitle_enable_toggled_cb(
GtkCellRendererToggle *cell,
ghb_subtitle_exclusive_burn(ud, track);
}
+G_MODULE_EXPORT void
+subtitle_default_toggled_cb(
+ GtkCellRendererToggle *cell,
+ gchar *path,
+ signal_user_data_t *ud)
+{
+ GtkTreeView *tv;
+ GtkTreeModel *tm;
+ GtkTreeIter ti;
+ GtkTreePath *tp;
+ gboolean active;
+ gint row;
+ gint *indices;
+ GValue *subtitle_list;
+ gint count, track;
+ GValue *settings;
+
+ g_debug("default toggled");
+ tp = gtk_tree_path_new_from_string (path);
+ tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
+ g_return_if_fail(tv != NULL);
+ tm = gtk_tree_view_get_model(tv);
+ g_return_if_fail(tm != NULL);
+ gtk_tree_model_get_iter(tm, &ti, tp);
+ gtk_tree_model_get(tm, &ti, 4, &active, -1);
+ active ^= 1;
+
+ // Get the row number
+ indices = gtk_tree_path_get_indices (tp);
+ row = indices[0];
+ gtk_tree_path_free(tp);
+
+ subtitle_list = ghb_settings_get_value(ud->settings, "subtitle_list");
+ count = ghb_array_len(subtitle_list);
+ if (row < 0 || row >= count)
+ return;
+
+ settings = ghb_array_get_nth(subtitle_list, row);
+ track = ghb_settings_combo_int(settings, "SubtitleTrack");
+
+ ghb_settings_set_boolean(settings, "SubtitleDefaultTrack", active);
+
+ gtk_list_store_set(GTK_LIST_STORE(tm), &ti, 4, active, -1);
+ // allow only one default
+ ghb_subtitle_exclusive_default(ud, track);
+}
+
static gboolean
trackUsed(signal_user_data_t *ud, gint track)
{
// These are displayed in list
1, track,
3, burned,
- 4, source,
+ 5, source,
// These are used to set combo values when a list item is selected
- 5, s_track,
+ 6, s_track,
-1);
g_free(s_track);
ghb_live_reset(ud);
GtkListStore *store;
GtkTreeSelection *selection;
const gchar *track, *source;
- gboolean forced, burned, enabled;
+ gboolean forced, burned, enabled, def;
gchar *s_track;
gint i_track;
enabled = ghb_settings_get_boolean(settings, "SubtitleEnabled");
forced = ghb_settings_get_boolean(settings, "SubtitleForced");
burned = ghb_settings_get_boolean(settings, "SubtitleBurned");
+ def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack");
s_track = ghb_settings_get_string(settings, "SubtitleTrack");
i_track = ghb_settings_get_int(settings, "SubtitleTrack");
1, track,
2, forced,
3, burned,
- 4, source,
+ 4, def,
+ 5, source,
// These are used to set combo box values when a list item is selected
- 5, s_track,
- 6, can_delete,
+ 6, s_track,
+ 7, can_delete,
-1);
gtk_tree_selection_select_iter(selection, &iter);
g_free(s_track);
const gchar *track;
gboolean can_delete;
- gtk_tree_model_get(store, &iter, 5, &track, 6, &can_delete, -1);
+ gtk_tree_model_get(store, &iter, 6, &track, 7, &can_delete, -1);
ghb_settings_set_string(ud->settings, "SubtitleTrack", track);
if (can_delete)
GValue *slist;
GValue *subtitle;
gint count, ii, tt;
- gboolean forced, burned, enabled;
+ gboolean enabled, forced, burned, def;
g_debug("ghb_set_subtitle");
slist = ghb_settings_get_value(ud->settings, "subtitle_list");
enabled = ghb_settings_get_boolean(settings, "SubtitleEnabled");
forced = ghb_settings_get_boolean(settings, "SubtitleForced");
burned = ghb_settings_get_boolean(settings, "SubtitleBurned");
+ def = ghb_settings_get_boolean(settings, "SubtitleDefaultTrack");
tv = GTK_TREE_VIEW(GHB_WIDGET(ud->builder, "subtitle_list"));
g_return_if_fail(tv != NULL);
ghb_settings_set_boolean(subtitle, "SubtitleEnabled", enabled);
ghb_settings_set_boolean(subtitle, "SubtitleForced", forced);
ghb_settings_set_boolean(subtitle, "SubtitleBurned", burned);
+ ghb_settings_set_boolean(subtitle, "SubtitleDefaultTrack", def);
gtk_list_store_set(GTK_LIST_STORE(tm), &ti,
0, enabled,
2, forced,
3, burned,
- 6, FALSE,
+ 4, def,
+ 7, FALSE,
-1);
break;
}
typedef struct hb_audio_s hb_audio_t;
typedef struct hb_audio_config_s hb_audio_config_t;
typedef struct hb_subtitle_s hb_subtitle_t;
+typedef struct hb_subtitle_config_s hb_subtitle_config_t;
typedef struct hb_metadata_s hb_metadata_t;
typedef struct hb_state_s hb_state_t;
typedef union hb_esconfig_u hb_esconfig_t;
int amixdown;
};
+struct hb_subtitle_config_s
+{
+ enum subdest { RENDERSUB, PASSTHRUSUB } dest;
+ int force;
+ int default_track;
+};
+
#define HB_VIDEO_RATE_BASE 27000000
extern hb_rate_t hb_video_rates[];
int mp4_optimize;
int ipod_atom;
- int indepth_scan;
- hb_subtitle_t ** select_subtitle;
- char * native_language;
+ int indepth_scan;
+ hb_subtitle_config_t select_subtitle_config;
+ hb_subtitle_t ** select_subtitle;
+ char * native_language;
int angle; // dvd angle to encode
int frame_to_stop; // declare eof when we hit this frame
struct hb_subtitle_s
{
- int track;
int id;
+ int track;
+
+ hb_subtitle_config_t config;
+
enum subtype { PICTURESUB, TEXTSUB } format;
enum subsource { VOBSUB, SRTSUB, CC608SUB, CC708SUB } source;
- enum subdest { RENDERSUB, PASSTHRUSUB } dest;
- int force;
char lang[1024];
char iso639_2[4];
uint8_t type; /* Closed Caption, Childrens, Directors etc */
}
subtitle->format = TEXTSUB;
subtitle->source = CC608SUB;
- subtitle->dest = PASSTHRUSUB;
+ subtitle->config.dest = PASSTHRUSUB;
subtitle->type = 5;
hb_list_add( m->title->list_subtitle, subtitle );
/* Get infos about the subtitle */
ParseControls( w );
- if( job->indepth_scan || ( w->subtitle->force && pv->pts_forced == 0 ) )
+ if( job->indepth_scan || ( w->subtitle->config.force && pv->pts_forced == 0 ) )
{
/*
* Don't encode subtitles when doing a scan.
return NULL;
}
- if (w->subtitle->dest == PASSTHRUSUB)
+ if (w->subtitle->config.dest == PASSTHRUSUB)
{
pv->buf->start = pv->pts_start;
pv->buf->stop = pv->pts_stop;
lang->iso639_2);
subtitle->format = PICTURESUB;
subtitle->source = VOBSUB;
- subtitle->dest = RENDERSUB; // By default render (burn-in) the VOBSUB.
+ subtitle->config.dest = RENDERSUB; // By default render (burn-in) the VOBSUB.
subtitle->type = lang_extension;
lang->iso639_2);
subtitle->format = PICTURESUB;
subtitle->source = VOBSUB;
- subtitle->dest = RENDERSUB; // By default render (burn-in) the VOBSUB.
+ subtitle->config.dest = RENDERSUB; // By default render (burn-in) the VOBSUB.
subtitle->type = lang_extension;
for( i=0; i < hb_list_count( title->list_subtitle ); i++ )
{
subtitle = hb_list_item( title->list_subtitle, i );
- if( strcmp( subtitle->iso639_2, audio_lang ) == 0 )
+ if( strcmp( subtitle->iso639_2, audio_lang ) == 0 &&
+ subtitle->source == VOBSUB )
{
/*
* Matched subtitle language with audio language, so
* Not doing a subtitle scan in this pass, but maybe we are in the
* first pass?
*/
- if( job->select_subtitle )
+ if( job->pass != 1 && job->native_language )
{
/*
- * Don't add subtitles here, we'll add them via select_subtitle
- * at the end of the subtitle_scan.
+ * We are not doing a subtitle scan but do want the
+ * native langauge subtitle selected, so select it
+ * for pass 0 or pass 2 of a two pass.
*/
+ for( i=0; i < hb_list_count( title->list_subtitle ); i++ )
+ {
+ subtitle = hb_list_item( title->list_subtitle, i );
+ if( strcmp( subtitle->iso639_2, audio_lang ) == 0 )
+ {
+ /*
+ * Matched subtitle language with audio language, so
+ * add this to our list to scan.
+ */
+ subtitle_copy = malloc( sizeof( hb_subtitle_t ) );
+ memcpy( subtitle_copy, subtitle, sizeof( hb_subtitle_t ) );
+ hb_list_add( title_copy->list_subtitle, subtitle_copy );
+ break;
+ }
+ }
} else {
/*
- * Definitely not doing a subtitle scan.
+ * Manually selected subtitles, in which case only
+ * bother adding them for pass 0 or pass 2 of a two
+ * pass.
*/
- if( job->pass != 1 && job->native_language )
+ if( job->pass != 1 )
{
/*
- * We are not doing a subtitle scan but do want the
- * native langauge subtitle selected, so select it
- * for pass 0 or pass 2 of a two pass.
+ * Copy all of them from the input job, to the title_copy/job_copy.
*/
- for( i=0; i < hb_list_count( title->list_subtitle ); i++ )
- {
- subtitle = hb_list_item( title->list_subtitle, i );
- if( strcmp( subtitle->iso639_2, audio_lang ) == 0 )
+ for( i = 0; i < hb_list_count(job->list_subtitle); i++ ) {
+ if( ( subtitle = hb_list_item( job->list_subtitle, i ) ) )
{
- /*
- * Matched subtitle language with audio language, so
- * add this to our list to scan.
- */
subtitle_copy = malloc( sizeof( hb_subtitle_t ) );
memcpy( subtitle_copy, subtitle, sizeof( hb_subtitle_t ) );
hb_list_add( title_copy->list_subtitle, subtitle_copy );
- break;
- }
- }
- } else {
- /*
- * Manually selected subtitles, in which case only
- * bother adding them for pass 0 or pass 2 of a two
- * pass.
- */
- if( job->pass != 1 )
- {
- /*
- * Copy all of them from the input job, to the title_copy/job_copy.
- */
- for( i = 0; i < hb_list_count(job->list_subtitle); i++ ) {
- if( ( subtitle = hb_list_item( job->list_subtitle, i ) ) )
- {
- subtitle_copy = malloc( sizeof( hb_subtitle_t ) );
- memcpy( subtitle_copy, subtitle, sizeof( hb_subtitle_t ) );
- hb_list_add( title_copy->list_subtitle, subtitle_copy );
- }
}
}
}
{
hb_subtitle_t *subtitle = hb_list_item( title->list_subtitle, i );
- if (subtitle->dest != PASSTHRUSUB)
+ if (subtitle->config.dest != PASSTHRUSUB)
continue;
add_mux_track( mux, subtitle->fifo_out, subtitle->mux_data, 0 );
}
int len;
subtitle = hb_list_item( title->list_subtitle, i );
- if (subtitle->dest != PASSTHRUSUB)
+ if (subtitle->config.dest != PASSTHRUSUB)
continue;
memset(track, 0, sizeof(mk_TrackConfig));
default:
continue;
}
+ if ( subtitle->config.default_track )
+ {
+ track->flagDefault = 1;
+ }
mux_data = calloc(1, sizeof( hb_mux_data_t ) );
subtitle->mux_data = mux_data;
hb_subtitle_t *subtitle = hb_list_item( job->list_subtitle, i );
if( subtitle && subtitle->format == TEXTSUB &&
- subtitle->dest == PASSTHRUSUB )
+ subtitle->config.dest == PASSTHRUSUB )
{
uint64_t width, height = 60;
if( job->anamorphic.mode )
subtitle = hb_list_item( title->list_subtitle, i );
if (id == subtitle->id) {
subtitle->hits++;
- if( !job->indepth_scan || subtitle->force )
+ if( !job->indepth_scan || subtitle->config.force )
{
/*
* Pass the subtitles to be processed if we are not scanning, or if
for( i = 0; i < hb_list_count( job->list_subtitle ); i++)
{
subtitle = hb_list_item( job->list_subtitle, i );
- if( subtitle->dest == PASSTHRUSUB )
+ if( subtitle->config.dest == PASSTHRUSUB )
{
hb_fifo_push( subtitle->fifo_out, hb_buffer_init( 0 ) );
}
for( i = 0; i < hb_list_count( job->list_subtitle ); i++)
{
subtitle = hb_list_item( job->list_subtitle, i );
- if( subtitle->dest == PASSTHRUSUB )
+ if( subtitle->config.dest == PASSTHRUSUB )
{
hb_fifo_push( subtitle->fifo_out, hb_buffer_init( 0 ) );
}
{
if( sub->size > 0 )
{
- if( subtitle->dest == RENDERSUB )
+ if( subtitle->config.dest == RENDERSUB )
{
if ( cur->sub == NULL )
{
/*
* EOF - consume for rendered, else pass through
*/
- if( subtitle->dest == RENDERSUB )
+ if( subtitle->config.dest == RENDERSUB )
{
sub = hb_fifo_get( subtitle->fifo_raw );
hb_buffer_close( &sub );
subtitle->source == VOBSUB ? "VOBSUB" :
((subtitle->source == CC608SUB ||
subtitle->source == CC708SUB) ? "CC" : "SRT"),
- subtitle->dest == RENDERSUB ? "Render/Burn in" : "Pass-Through");
+ subtitle->config.dest == RENDERSUB ? "Render/Burn in" : "Pass-Through");
}
}
hb_list_add( job->list_work, w );
}
- if( job->select_subtitle && !job->indepth_scan )
+ /*
+ * Look for the scanned subtitle in the existing subtitle list
+ */
+ if ( !job->indepth_scan && job->select_subtitle && *(job->select_subtitle) )
{
/*
- * Must be second pass of a two pass with subtitle scan enabled, so
- * add the subtitle that we found on the first pass for use in this
- * pass.
+ * Disable forced subtitles if we didn't find any in the scan
+ * so that we display normal subtitles instead.
+ *
+ * select_subtitle implies that we did a scan.
*/
- if (*(job->select_subtitle))
+ if( (*job->select_subtitle)->config.force &&
+ (*job->select_subtitle)->forced_hits == 0 )
{
- hb_list_add( title->list_subtitle, *( job->select_subtitle ) );
+ (*job->select_subtitle)->config.force = 0;
+ }
+ for( i=0; i < hb_list_count(title->list_subtitle); i++ )
+ {
+ subtitle = hb_list_item( title->list_subtitle, i );
+
+ if( subtitle )
+ {
+ /*
+ * Disable forced subtitles if we didn't find any in the scan
+ * so that we display normal subtitles instead.
+ *
+ * select_subtitle implies that we did a scan.
+ */
+ if( (*job->select_subtitle)->id == subtitle->id )
+ {
+ *subtitle = *(*job->select_subtitle);
+ free( *job->select_subtitle );
+ free( job->select_subtitle );
+ job->select_subtitle = NULL;
+ }
+ }
+ }
+
+ if( job->select_subtitle )
+ {
+ /*
+ * Its not in the existing list
+ *
+ * Must be second pass of a two pass with subtitle scan enabled, so
+ * add the subtitle that we found on the first pass for use in this
+ * pass.
+ */
+ hb_list_add( title->list_subtitle, *job->select_subtitle );
+ free( job->select_subtitle );
+ job->select_subtitle = NULL;
}
}
+ else if ( !job->indepth_scan && job->select_subtitle )
+ {
+ free( job->select_subtitle );
+ job->select_subtitle = NULL;
+ }
+
for( i=0; i < hb_list_count(title->list_subtitle); i++ )
{
subtitle->fifo_sync = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
subtitle->fifo_out = hb_fifo_init( FIFO_CPU_MULT * cpu_count );
- /*
- * Disable forced subtitles if we didn't find any in the scan
- * so that we display normal subtitles instead.
- *
- * select_subtitle implies that we did a scan.
- */
- if( !job->indepth_scan && subtitle->force &&
- job->select_subtitle )
- {
- if( subtitle->forced_hits == 0 )
- {
- subtitle->force = 0;
- }
- }
-
- if( (!job->indepth_scan || subtitle->force) &&
+ if( (!job->indepth_scan || subtitle->config.force) &&
subtitle->source == VOBSUB ) {
/*
* Don't add threads for subtitles when we are scanning, unless
if( !job->indepth_scan &&
subtitle->format == PICTURESUB
- && subtitle->dest == PASSTHRUSUB )
+ && subtitle->config.dest == PASSTHRUSUB )
{
/*
* Passing through a subtitle picture, this will have to
for( i=0; i < hb_list_count( title->list_subtitle ); i++ )
{
subtitle = hb_list_item( title->list_subtitle, i );
+
hb_log( "Subtitle stream 0x%x '%s': %d hits (%d forced)",
subtitle->id, subtitle->lang, subtitle->hits,
subtitle->forced_hits );
+
+ if( subtitle->hits == 0 )
+ continue;
+
if( subtitle->hits > subtitle_highest )
{
subtitle_highest = subtitle->hits;
subtitle = hb_list_item( title->list_subtitle, i );
if( subtitle->id == subtitle_hit )
{
+ subtitle->config = job->select_subtitle_config;
hb_list_rem( title->list_subtitle, subtitle );
- *( job->select_subtitle ) = subtitle;
+ *job->select_subtitle = subtitle;
+ break;
}
}
- } else {
- /*
- * Must be the end of pass 0 or 2 - we don't need this anymore.
- *
- * Have to put the subtitle list back together in the title though
- * or the GUI will have a hissy fit.
- */
- free( job->select_subtitle );
- job->select_subtitle = NULL;
}
}
hb_subtitle_t *subtitle = (hb_subtitle_t *) hb_list_item( title->list_subtitle,
[[queueToApply objectForKey:@"JobSubtitlesIndex"] intValue] - 2 );
if( [[queueToApply objectForKey:@"SubtitlesForced"] intValue] == 1 )
- subtitle->force = 1;
+ subtitle->config.force = 1;
else
- subtitle->force = 0;
+ subtitle->config.force = 0;
hb_list_add( job->list_subtitle, subtitle );
break;
}
subtitle = hb_list_item( title->list_subtitle, sub-1 );
if( subtitle ) {
if( subtitle_force ) {
- subtitle->force = subtitle_force;
+ subtitle->config.force = subtitle_force;
}
hb_list_add( job->list_subtitle, subtitle );
} else {
job->select_subtitle = malloc(sizeof(hb_subtitle_t*));
*(job->select_subtitle) = NULL;
+ job->select_subtitle_config.dest = RENDERSUB;
+ job->select_subtitle_config.default_track = 0;
+ job->select_subtitle_config.force = subtitle_force;
+
/*
* Add the pre-scan job
*/