| 4878 | |
| 4879 | |
| 4880 | static int add_sub(hb_value_array_t *list, hb_title_t *title, int track, int out_track, int *one_burned, int keep_name) |
| 4881 | { |
| 4882 | hb_subtitle_t *subtitle; |
| 4883 | // Check that the track exists |
| 4884 | subtitle = hb_list_item(title->list_subtitle, track); |
| 4885 | if (subtitle == NULL) |
| 4886 | { |
| 4887 | fprintf(stderr, "Warning: Could not find subtitle track %d, skipped\n", |
| 4888 | track + 1); |
| 4889 | return -1; |
| 4890 | } |
| 4891 | |
| 4892 | int burn = !*one_burned && subburn == out_track && |
| 4893 | hb_subtitle_can_burn(subtitle->source); |
| 4894 | *one_burned |= burn; |
| 4895 | int def = subdefault == out_track; |
| 4896 | int force = test_sub_list(subforce, out_track); |
| 4897 | |
| 4898 | if (!burn && |
| 4899 | !hb_subtitle_can_pass(subtitle->source, mux)) |
| 4900 | { |
| 4901 | // Only allow one subtitle to be burned into video |
| 4902 | if (*one_burned) |
| 4903 | { |
| 4904 | fprintf(stderr, "Warning: Skipping subtitle track %d, can't have more than one track burnt in\n", track + 1); |
| 4905 | return -1; |
| 4906 | } |
| 4907 | *one_burned = 1; |
| 4908 | } |
| 4909 | |
| 4910 | const char *name = keep_name && subtitle->name != NULL && subtitle->name[0] != 0 ? subtitle->name : NULL; |
| 4911 | |
| 4912 | hb_dict_t *subtitle_dict = hb_dict_init(); |
| 4913 | hb_dict_set(subtitle_dict, "Track", hb_value_int(track)); |
| 4914 | hb_dict_set(subtitle_dict, "Default", hb_value_bool(def)); |
| 4915 | hb_dict_set(subtitle_dict, "Forced", hb_value_bool(force)); |
| 4916 | hb_dict_set(subtitle_dict, "Burn", hb_value_bool(burn)); |
| 4917 | if (name) |
| 4918 | { |
| 4919 | hb_dict_set(subtitle_dict, "Name", hb_value_string(name)); |
| 4920 | } |
| 4921 | hb_value_array_append(list, subtitle_dict); |
| 4922 | return 0; |
| 4923 | } |
| 4924 | |
| 4925 | static int add_srt(hb_value_array_t *list, int track, int *one_burned) |
| 4926 | { |
no test coverage detected