Skip to content

Commit 330474f

Browse files
committed
screenshot: use mp_stripext for %F
Reuse existing functionality, see previous commit introducing above function.
1 parent 49095e5 commit 330474f

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

player/screenshot.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ void screenshot_init(struct MPContext *mpctx)
6868
};
6969
}
7070

71-
static char *stripext(void *talloc_ctx, const char *s)
72-
{
73-
const char *end = strrchr(mp_basename(s), '.');
74-
if (!end)
75-
end = s + strlen(s);
76-
return talloc_asprintf(talloc_ctx, "%.*s", (int)(end - s), s);
77-
}
78-
7971
static bool write_screenshot(struct mp_cmd_ctx *cmd, struct mp_image *img,
8072
const char *filename, struct image_writer_opts *opts,
8173
bool overwrite)
@@ -179,7 +171,7 @@ static char *create_fname(struct MPContext *mpctx, char *template,
179171
char *name = video_file ? mp_basename_or_url(video_file) : "NO_FILE";
180172

181173
if (fmt == 'F')
182-
name = stripext(res, video_file);
174+
name = mp_stripext(res, name);
183175
append_filename(&res, name);
184176
break;
185177
}

0 commit comments

Comments
 (0)