It's similar to av_get_frame_filename2 but with int64_t number support. Make av_get_frame_filename* a wrapper over ff_get_frame_filename.
Unified · Split
| @@ -745,6 +745,22 @@ void ff_format_set_url(AVFormatContext *s, char *url); · 744 unmodified lines | ||
| 745 | 745 | */ |
| 746 | 746 | int ff_match_url_ext(const char *url, const char *extensions); |
| 747 | 747 | |
| 748 | +/** | |
| 749 | + * Return in 'buf' the path with '%d' replaced by a number. | |
| 750 | + * | |
| 751 | + * Also handles the '%0nd' format where 'n' is the total number | |
| 752 | + * of digits and '%%'. | |
| 753 | + * | |
| 754 | + * @param buf destination buffer | |
| 755 | + * @param buf_size destination buffer size | |
| 756 | + * @param path path with substitution template | |
| 757 | + * @param number the number to substitute | |
| 758 | + * @param flags AV_FRAME_FILENAME_FLAGS_* | |
| 759 | + * @return 0 if OK, -1 on format error | |
| 760 | + */ | |
| 761 | +int ff_get_frame_filename(char *buf, int buf_size, const char *path, | |
| 762 | + int64_t number, int flags); | |
| 763 | + | |
| 748 | 764 | struct FFOutputFormat; |
| 749 | 765 | struct FFInputFormat; |
| 750 | 766 | void avpriv_register_devices(const struct FFOutputFormat * const o[], |
| @@ -280,7 +280,7 @@ uint64_t ff_parse_ntp_time(uint64_t ntp_ts) · 279 unmodified lines | ||
| 280 | 280 | return (sec * 1000000) + usec; |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | −int av_get_frame_filename2(char *buf, int buf_size, const char *path, int number, int flags) | |
| 283 | +int ff_get_frame_filename(char *buf, int buf_size, const char *path, int64_t number, int flags) | |
| 284 | 284 | { |
| 285 | 285 | const char *p; |
| 286 | 286 | char *q, buf1[20], c; |
| @@ -313,7 +313,7 @@ int av_get_frame_filename2(char *buf, int buf_size, const char *path, int number · 26 unmodified lines | ||
| 313 | 313 | percentd_found = 1; |
| 314 | 314 | if (number < 0) |
| 315 | 315 | nd += 1; |
| 316 | − snprintf(buf1, sizeof(buf1), "%0*d", nd, number); | |
| 316 | + snprintf(buf1, sizeof(buf1), "%0*" PRId64, nd, number); | |
| 317 | 317 | len = strlen(buf1); |
| 318 | 318 | if ((q - buf + len) > buf_size - 1) |
| 319 | 319 | goto fail; |
| @@ -338,9 +338,14 @@ fail: · 18 unmodified lines | ||
| 338 | 338 | return -1; |
| 339 | 339 | } |
| 340 | 340 | |
| 341 | +int av_get_frame_filename2(char *buf, int buf_size, const char *path, int number, int flags) | |
| 342 | +{ | |
| 343 | + return ff_get_frame_filename(buf, buf_size, path, number, flags); | |
| 344 | +} | |
| 345 | + | |
| 341 | 346 | int av_get_frame_filename(char *buf, int buf_size, const char *path, int number) |
| 342 | 347 | { |
| 343 | − return av_get_frame_filename2(buf, buf_size, path, number, 0); | |
| 348 | + return ff_get_frame_filename(buf, buf_size, path, number, 0); | |
| 344 | 349 | } |
| 345 | 350 | |
| 346 | 351 | void av_url_split(char *proto, int proto_size, |