It's most of the time redundant and there is no point to repeat it in `title`.
Unified · Split
| @@ -903,7 +903,14 @@ int mp_add_external_file(struct MPContext *mpctx, char *filename, · 902 unmodified lines | |||
| 903 | if (sh->title && sh->title[0]) { | 903 | if (sh->title && sh->title[0]) { |
| 904 | t->title = talloc_strdup(t, sh->title); | 904 | t->title = talloc_strdup(t, sh->title); |
| 905 | } else { | 905 | } else { |
| 906 | t->title = talloc_strdup(t, mp_basename(disp_filename)); | 906 | bstr parent = {0}; |
| 907 | if (mpctx->filename) | ||
| 908 | parent = bstr_strip_ext(bstr0(mp_basename(mpctx->filename))); | ||
| 909 | bstr title = bstr0(mp_basename(disp_filename)); | ||
| 910 | bstr_eatstart(&title, parent); | ||
| 911 | bstr_eatstart(&title, bstr0(".")); | ||
| 912 | if (title.len) | ||
| 913 | t->title = bstrdup0(t, title); | ||
| 907 | } | 914 | } |
| 908 | t->external_filename = mp_normalize_user_path(t, mpctx->global, filename); | 915 | t->external_filename = mp_normalize_user_path(t, mpctx->global, filename); |
| 909 | t->no_default = sh->type != filter; | 916 | t->no_default = sh->type != filter; |