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

Function ghb_subtitle_prune

gtk/src/subtitlehandler.c:1383–1423  ·  view source on GitHub ↗

When the container changes, it may be necessary to burn additional subtitles. Since only one can be burned, some subtitles may be removed from the list.

Source from the content-addressed store, hash-verified

1381// subtitles. Since only one can be burned, some subtitles may be
1382// removed from the list.
1383void
1384ghb_subtitle_prune(signal_user_data_t *ud)
1385{
1386 GhbValue *subtitle_list;
1387 GhbValue *subsettings;
1388 gboolean one_burned = FALSE;
1389
1390 subtitle_list = ghb_get_job_subtitle_list(ud->settings);
1391 if (subtitle_list == NULL)
1392 return;
1393
1394 const char *mux_id;
1395 const hb_container_t *mux;
1396
1397 mux_id = ghb_dict_get_string(ud->settings, "FileFormat");
1398 mux = ghb_lookup_container_by_name(mux_id);
1399
1400 for (guint ii = 0; ii < ghb_array_len(subtitle_list); )
1401 {
1402 gboolean burned;
1403 int source;
1404
1405 subsettings = ghb_array_get(subtitle_list, ii);
1406 burned = ghb_dict_get_bool(subsettings, "Burn");
1407 source = get_sub_source(ud->settings, subsettings);
1408 burned = burned || !hb_subtitle_can_pass(source, mux->format);
1409 if (burned && one_burned)
1410 {
1411 ghb_array_remove(subtitle_list, ii);
1412 continue;
1413 }
1414 one_burned = one_burned || burned;
1415 ghb_dict_set_bool(subsettings, "Burn", burned);
1416 ii++;
1417 }
1418 subsettings = subtitle_get_selected_settings(ud, NULL);
1419 if (subsettings != NULL)
1420 {
1421 subtitle_update_dialog_widgets(ud, subsettings);
1422 }
1423}
1424
1425G_MODULE_EXPORT void
1426subtitle_def_widget_changed_cb (GtkWidget *widget, gpointer data)

Callers 1

container_changed_cbFunction · 0.85

Calls 9

ghb_dict_get_stringFunction · 0.85
ghb_dict_get_boolFunction · 0.85
get_sub_sourceFunction · 0.85
hb_subtitle_can_passFunction · 0.85
ghb_dict_set_boolFunction · 0.85

Tested by

no test coverage detected