| 428 | } |
| 429 | |
| 430 | static 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) |
no test coverage detected