MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / subtitle_add_track

Function subtitle_add_track

gtk/src/subtitlehandler.c:430–508  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

428}
429
430static GhbValue* subtitle_add_track(
431 signal_user_data_t *ud,
432 GhbValue *settings,
433 int track,
434 int mux,
435 gboolean default_track,
436 gboolean import,
437 int source,
438 gboolean burn,
439 gboolean *burned)
440{
441 const char * name = NULL;
442 if (track >= 0 && !import)
443 {
444 GhbValue * strack;
445
446 strack = ghb_get_title_subtitle_track(settings, track);
447 source = ghb_dict_get_int(strack, "Source");
448
449 int keep_name = ghb_dict_get_int(settings, "SubtitleTrackNamePassthru");
450 if (keep_name)
451 {
452 name = ghb_dict_get_string(strack, "Name");
453 }
454 }
455
456 burn |= !hb_subtitle_can_pass(source, mux);
457
458 if (*burned && burn)
459 {
460 // Can only burn one. Skip others that must be burned.
461 return NULL;
462 }
463
464 GhbValue *subsettings = ghb_dict_new();
465 if (import)
466 {
467 // Set default SRT settings
468 GhbValue *import_dict;
469 const gchar *pref_lang, *dir;
470 gchar *filename;
471
472 import_dict = ghb_dict_new();
473 hb_dict_set(subsettings, "Import", import_dict);
474
475 ghb_dict_set_string(import_dict, "Format",
476 source == IMPORTSRT ? "SRT" : "SSA");
477 pref_lang = ghb_dict_get_string(settings, "PreferredLanguage");
478 ghb_dict_set_string(import_dict, "Language", pref_lang);
479 ghb_dict_set_string(import_dict, "Codeset", "UTF-8");
480
481 dir = ghb_dict_get_string(ud->prefs, "SrtDir");
482 filename = g_strdup_printf("%s/none", dir);
483 ghb_dict_set_string(import_dict, "Filename", filename);
484 g_free(filename);
485 }
486
487 if (name != NULL && name[0] != 0)

Callers 3

ghb_add_subtitle_filesFunction · 0.85
subtitle_add_cbFunction · 0.85
subtitle_add_all_cbFunction · 0.85

Calls 9

ghb_dict_get_intFunction · 0.85
ghb_dict_get_stringFunction · 0.85
hb_subtitle_can_passFunction · 0.85
hb_dict_setFunction · 0.85
ghb_dict_set_stringFunction · 0.85
ghb_dict_set_intFunction · 0.85
ghb_dict_set_boolFunction · 0.85
subtitle_add_to_settingsFunction · 0.85

Tested by

no test coverage detected