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

Function add_srt

test/test.c:4925–4965  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4923}
4924
4925static int add_srt(hb_value_array_t *list, int track, int *one_burned)
4926{
4927 char *codeset = "ISO-8859-1";
4928 int64_t offset = 0;
4929 char *iso639_2 = "und";
4930 int burn = !*one_burned && srtburn == track + 1 &&
4931 hb_subtitle_can_burn(IMPORTSRT);
4932 *one_burned |= burn;
4933 int def = srtdefault == track + 1;
4934
4935 if (srtcodeset && track < hb_str_vlen(srtcodeset) && srtcodeset[track])
4936 codeset = srtcodeset[track];
4937 if (srtoffset && track < hb_str_vlen(srtoffset) && srtoffset[track])
4938 offset = strtoll(srtoffset[track], NULL, 0);
4939 if (srtlang && track < hb_str_vlen(srtlang) && srtlang[track])
4940 {
4941 const iso639_lang_t *lang = lang_lookup(srtlang[track]);
4942 if (lang != NULL)
4943 {
4944 iso639_2 = lang->iso639_2;
4945 }
4946 else
4947 {
4948 fprintf(stderr, "Warning: Invalid SRT language (%s)\n",
4949 srtlang[track]);
4950 }
4951 }
4952
4953 hb_dict_t *subtitle_dict = hb_dict_init();
4954 hb_dict_t *srt_dict = hb_dict_init();
4955 hb_dict_set(subtitle_dict, "Import", srt_dict);
4956 hb_dict_set(subtitle_dict, "Default", hb_value_bool(def));
4957 hb_dict_set(subtitle_dict, "Burn", hb_value_bool(burn));
4958 hb_dict_set(subtitle_dict, "Offset", hb_value_int(offset));
4959 hb_dict_set(srt_dict, "Format", hb_value_string("SRT"));
4960 hb_dict_set(srt_dict, "Filename", hb_value_string(srtfile[track]));
4961 hb_dict_set(srt_dict, "Language", hb_value_string(iso639_2));
4962 hb_dict_set(srt_dict, "Codeset", hb_value_string(codeset));
4963 hb_value_array_append(list, subtitle_dict);
4964 return 0;
4965}
4966
4967static int add_ssa(hb_value_array_t *list, int track, int *one_burned)
4968{

Callers 1

PrepareJobFunction · 0.85

Calls 9

hb_subtitle_can_burnFunction · 0.85
hb_str_vlenFunction · 0.85
lang_lookupFunction · 0.85
hb_dict_initFunction · 0.85
hb_dict_setFunction · 0.85
hb_value_boolFunction · 0.85
hb_value_intFunction · 0.85
hb_value_stringFunction · 0.85
hb_value_array_appendFunction · 0.85

Tested by

no test coverage detected