mirror of
https://github.com/mpv-player/mpv.git
synced 2026-10-16 22:40:53 +08:00
misc/path_utils: rename bstr_get_ext() to mp_get_ext()
This commit is contained in:
committed by
Kacper Michajłow
parent
4fa3c38983
commit
089c172dff
+1
-1
@@ -466,7 +466,7 @@ static int lavf_check_file(demuxer_t *demuxer, enum demux_check check)
|
||||
|
||||
// HLS streams seems to be not well tagged, so matching mime type is not
|
||||
// enough. Strip URL parameters and match extension.
|
||||
bstr ext = bstr_get_ext(bstr_split(bstr0(priv->filename), "?#", NULL));
|
||||
bstr ext = mp_get_ext(bstr_split(bstr0(priv->filename), "?#", NULL));
|
||||
AVProbeData avpd = {
|
||||
// Disable file-extension matching with normal checks, except for HLS
|
||||
.filename = !bstrcasecmp0(ext, "m3u8") || !bstrcasecmp0(ext, "m3u") ||
|
||||
|
||||
@@ -89,7 +89,7 @@ static int open_file(struct demuxer *demuxer, enum demux_check check)
|
||||
|
||||
while (mp_archive_next_entry(mpa)) {
|
||||
if (filter && filter[0]) {
|
||||
bstr ext = bstr_get_ext(bstr0(mpa->entry_filename));
|
||||
bstr ext = mp_get_ext(bstr0(mpa->entry_filename));
|
||||
bool pass = false;
|
||||
|
||||
if (bstr_in_list0(bstr0("video"), filter))
|
||||
|
||||
@@ -249,7 +249,7 @@ static int parse_m3u(struct pl_parser *p)
|
||||
if (p->probing && !bstr_equals0(line, "#EXTM3U")) {
|
||||
// Last resort: if the file extension is m3u, it might be headerless.
|
||||
if (p->check_level == DEMUX_CHECK_UNSAFE) {
|
||||
bstr ext = bstr_get_ext(bstr0(p->real_stream->url));
|
||||
bstr ext = mp_get_ext(bstr0(p->real_stream->url));
|
||||
char probe[PROBE_SIZE];
|
||||
int len = stream_read_peek(p->real_stream, probe, sizeof(probe));
|
||||
bstr data = {probe, len};
|
||||
@@ -426,7 +426,7 @@ static bool test_path(struct pl_parser *p, char *path, int autocreate)
|
||||
if (!strcmp(path, p->real_stream->path))
|
||||
return true;
|
||||
|
||||
bstr ext = bstr_get_ext(bstr0(path));
|
||||
bstr ext = mp_get_ext(bstr0(path));
|
||||
if (autocreate & AUTO_VIDEO && bstr_in_list0(ext, p->mp_opts->video_exts))
|
||||
return true;
|
||||
if (autocreate & AUTO_AUDIO && bstr_in_list0(ext, p->mp_opts->audio_exts))
|
||||
@@ -535,7 +535,7 @@ static int parse_dir(struct pl_parser *p)
|
||||
p->pl->playlist_dir = NULL;
|
||||
if (p->autocreate_playlist && p->real_stream->is_local_fs && p->real_stream->is_regular &&
|
||||
!p->real_stream->is_directory) {
|
||||
bstr ext = bstr_get_ext(bstr0(p->real_stream->url));
|
||||
bstr ext = mp_get_ext(bstr0(p->real_stream->url));
|
||||
switch (p->autocreate_playlist) {
|
||||
case 1: // filter
|
||||
autocreate = get_directory_filter(p);
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ static bool might_be_subtitle_file(mpv_node *sub_exts, char *file)
|
||||
mpv_node sub_ext = sub_exts->u.list->values[i];
|
||||
if (sub_ext.format != MPV_FORMAT_STRING)
|
||||
continue;
|
||||
if (!bstrcasecmp0(bstr_get_ext(bstr0(file)), sub_ext.u.string))
|
||||
if (!bstrcasecmp0(mp_get_ext(bstr0(file)), sub_ext.u.string))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ bstr bstr_strip_ext(bstr path)
|
||||
return root.len ? root : path;
|
||||
}
|
||||
|
||||
bstr bstr_get_ext(bstr path)
|
||||
bstr mp_get_ext(bstr path)
|
||||
{
|
||||
return split_ext(path, NULL);
|
||||
}
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ const char *mp_basename(const char *path);
|
||||
bstr mp_basename_bstr(bstr path);
|
||||
|
||||
bstr bstr_strip_ext(bstr path);
|
||||
bstr bstr_get_ext(bstr path);
|
||||
bstr mp_get_ext(bstr path);
|
||||
|
||||
/* Return struct bstr referencing directory part of path, or if that
|
||||
* would be empty, ".".
|
||||
|
||||
@@ -166,7 +166,7 @@ void mp_load_auto_profiles(struct MPContext *mpctx)
|
||||
mp_auto_load_profile(mpctx, "protocol",
|
||||
mp_split_proto(bstr0(mpctx->filename), NULL));
|
||||
mp_auto_load_profile(mpctx, "extension",
|
||||
bstr_get_ext(bstr0(mpctx->filename)));
|
||||
mp_get_ext(bstr0(mpctx->filename)));
|
||||
|
||||
mp_load_per_file_config(mpctx);
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ static void append_dir_external_files(struct mpv_global *global, struct MPOpts *
|
||||
"UTF-8-MAC", MP_NO_LATIN1_FALLBACK);
|
||||
// retrieve various parts of the filename
|
||||
struct bstr tmp_fname_noext = bstrdup(tmpmem2, bstr_strip_ext(dename));
|
||||
struct bstr tmp_fname_ext = bstr_get_ext(dename);
|
||||
struct bstr tmp_fname_ext = mp_get_ext(dename);
|
||||
struct bstr tmp_fname_trim = bstr_strip(tmp_fname_noext);
|
||||
|
||||
if (den.start != dename.start)
|
||||
|
||||
+1
-1
@@ -489,7 +489,7 @@ void cmd_screenshot_to_file(void *p)
|
||||
int mode = cmd->args[1].v.i;
|
||||
struct image_writer_opts opts = *mpctx->opts->screenshot_image_opts;
|
||||
|
||||
int format = image_writer_format_from_ext(bstr_get_ext(bstr0(filename)));
|
||||
int format = image_writer_format_from_ext(mp_get_ext(bstr0(filename)));
|
||||
if (format)
|
||||
opts.format = format;
|
||||
bool high_depth = image_writer_high_depth(&opts);
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ static MP_THREAD_VOID script_thread(void *p)
|
||||
|
||||
static int64_t mp_load_script(struct MPContext *mpctx, const char *fname)
|
||||
{
|
||||
bstr ext = bstr_get_ext(bstr0(fname));
|
||||
bstr ext = mp_get_ext(bstr0(fname));
|
||||
if (bstrcasecmp0(ext, "disable") == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user