Browse code

avformat: Add av_get_frame_filename2() and AV_FRAME_FILENAME_FLAGS_MULTIPLE

This will be used to allow writing file sequences using the tee output onto
multiple places in parallel

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

Michael Niedermayer authored on 2016/08/04 03:34:20
Showing 4 changed files
... ...
@@ -15,6 +15,9 @@ libavutil:     2015-08-28
15 15
 
16 16
 API changes, most recent first:
17 17
 
18
+2016-08-04 - xxxxxxx - lavf 57.46.100 - avformat.h
19
+  Add av_get_frame_filename2()
20
+
18 21
 2016-07-09 - xxxxxxx / 90f469a - lavc 57.50.100 / 57.20.0 - avcodec.h
19 22
   Add FF_PROFILE_H264_MULTIVIEW_HIGH and FF_PROFILE_H264_STEREO_HIGH.
20 23
 
... ...
@@ -2720,6 +2720,9 @@ void av_dump_format(AVFormatContext *ic,
2720 2720
                     const char *url,
2721 2721
                     int is_output);
2722 2722
 
2723
+
2724
+#define AV_FRAME_FILENAME_FLAGS_MULTIPLE 1 ///< Allow multiple %d
2725
+
2723 2726
 /**
2724 2727
  * Return in 'buf' the path with '%d' replaced by a number.
2725 2728
  *
... ...
@@ -2730,8 +2733,12 @@ void av_dump_format(AVFormatContext *ic,
2730 2730
  * @param buf_size destination buffer size
2731 2731
  * @param path numbered sequence string
2732 2732
  * @param number frame number
2733
+ * @param flags AV_FRAME_FILENAME_FLAGS_*
2733 2734
  * @return 0 if OK, -1 on format error
2734 2735
  */
2736
+int av_get_frame_filename2(char *buf, int buf_size,
2737
+                          const char *path, int number, int flags);
2738
+
2735 2739
 int av_get_frame_filename(char *buf, int buf_size,
2736 2740
                           const char *path, int number);
2737 2741
 
... ...
@@ -4315,7 +4315,7 @@ uint64_t ff_ntp_time(void)
4315 4315
     return (av_gettime() / 1000) * 1000 + NTP_OFFSET_US;
4316 4316
 }
4317 4317
 
4318
-int av_get_frame_filename(char *buf, int buf_size, const char *path, int number)
4318
+int av_get_frame_filename2(char *buf, int buf_size, const char *path, int number, int flags)
4319 4319
 {
4320 4320
     const char *p;
4321 4321
     char *q, buf1[20], c;
... ...
@@ -4340,7 +4340,7 @@ int av_get_frame_filename(char *buf, int buf_size, const char *path, int number)
4340 4340
             case '%':
4341 4341
                 goto addchar;
4342 4342
             case 'd':
4343
-                if (percentd_found)
4343
+                if (!(flags & AV_FRAME_FILENAME_FLAGS_MULTIPLE) && percentd_found)
4344 4344
                     goto fail;
4345 4345
                 percentd_found = 1;
4346 4346
                 if (number < 0)
... ...
@@ -4370,6 +4370,11 @@ fail:
4370 4370
     return -1;
4371 4371
 }
4372 4372
 
4373
+int av_get_frame_filename(char *buf, int buf_size, const char *path, int number)
4374
+{
4375
+    return av_get_frame_filename2(buf, buf_size, path, number, 0);
4376
+}
4377
+
4373 4378
 void av_url_split(char *proto, int proto_size,
4374 4379
                   char *authorization, int authorization_size,
4375 4380
                   char *hostname, int hostname_size,
... ...
@@ -32,7 +32,7 @@
32 32
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
33 33
 // Also please add any ticket numbers that you belive might be affected here
34 34
 #define LIBAVFORMAT_VERSION_MAJOR  57
35
-#define LIBAVFORMAT_VERSION_MINOR  45
35
+#define LIBAVFORMAT_VERSION_MINOR  46
36 36
 #define LIBAVFORMAT_VERSION_MICRO 100
37 37
 
38 38
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \