| 1134 | } |
| 1135 | |
| 1136 | G_MODULE_EXPORT void |
| 1137 | ghb_add_subtitle_files (GListModel *files, signal_user_data_t *ud) |
| 1138 | { |
| 1139 | // Add the current subtitle settings to the list. |
| 1140 | GhbValue *subsettings, *import; |
| 1141 | gboolean one_burned; |
| 1142 | |
| 1143 | g_return_if_fail(g_list_model_get_item_type(files) == G_TYPE_FILE); |
| 1144 | |
| 1145 | const char *pref_lang; |
| 1146 | int title_id, titleindex; |
| 1147 | const hb_title_t *title; |
| 1148 | |
| 1149 | title_id = ghb_dict_get_int(ud->settings, "title"); |
| 1150 | title = ghb_lookup_title(title_id, &titleindex); |
| 1151 | if (title == NULL) |
| 1152 | { |
| 1153 | return; |
| 1154 | } |
| 1155 | |
| 1156 | one_burned = subtitle_is_one_burned(ud->settings); |
| 1157 | |
| 1158 | const char *mux_id = ghb_dict_get_string(ud->settings, "FileFormat"); |
| 1159 | const hb_container_t *mux = ghb_lookup_container_by_name(mux_id); |
| 1160 | |
| 1161 | for (guint i = 0; i < g_list_model_get_n_items(files); i++) |
| 1162 | { |
| 1163 | g_autoptr(GFile) file = g_list_model_get_item(files, i); |
| 1164 | const char *filename = g_file_peek_path(file); |
| 1165 | |
| 1166 | subsettings = subtitle_add_track(ud, ud->settings, 0, |
| 1167 | mux->format, FALSE, TRUE, IMPORTSRT, |
| 1168 | FALSE, &one_burned); |
| 1169 | |
| 1170 | if (!subsettings) |
| 1171 | break; |
| 1172 | |
| 1173 | import = ghb_dict_new(); |
| 1174 | ghb_dict_set(subsettings, "Import", import); |
| 1175 | pref_lang = ghb_dict_get_string(ud->settings, "PreferredLanguage"); |
| 1176 | ghb_dict_set_string(import, "Language", pref_lang); |
| 1177 | ghb_dict_set_string(import, "Codeset", "UTF-8"); |
| 1178 | ghb_dict_set_string(import, "Filename", filename); |
| 1179 | ghb_dict_set_string(import, "Format", |
| 1180 | ghb_file_is_ssa_subtitle(filename) ? "SSA" : "SRT"); |
| 1181 | |
| 1182 | add_subtitle_to_ui(ud, subsettings); |
| 1183 | } |
| 1184 | } |
| 1185 | |
| 1186 | G_MODULE_EXPORT void |
| 1187 | subtitle_add_cb (GSimpleAction *action, GVariant *param, gpointer data) |
no test coverage detected