]> git.sesse.net Git - ffmpeg/commitdiff
avformat: Make AVChapter.id an int64_t on next major bump
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Tue, 16 Mar 2021 07:29:59 +0000 (08:29 +0100)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 19 Mar 2021 01:36:58 +0000 (02:36 +0100)
64 bits are needed in order to retain the uid values of Matroska
chapters; the type is kept signed because the semantics of NUT chapters
depend upon whether the id is > 0 or < 0.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
doc/APIchanges
libavformat/aadec.c
libavformat/avformat.h
libavformat/internal.h
libavformat/matroskaenc.c
libavformat/nutdec.c
libavformat/utils.c
libavformat/version.h

index 849d95a7ed9ad34104de660188b25d2e10d45fe6..937ea70fbcf62499f54752be25bc5d123071cbfc 100644 (file)
@@ -15,6 +15,10 @@ libavutil:     2017-10-21
 
 API changes, most recent first:
 
+2021-03-19 - xxxxxxxxxx - lavf 58.75.100  - avformat.h
+  AVChapter.id will be changed from int to int64_t
+  on the next major version bump.
+
 2021-03-xx - xxxxxxxxxx - lavc 58.133.100 - codec.h
   Deprecated av_init_packet(). Once removed, sizeof(AVPacket) will
   no longer be a part of the public ABI.
index e88cdb89df7708fe774c3cb0155fd18dea6f84a4..80ca2c12d79ac20b4b64a95cf2e1b0dc946a81c5 100644 (file)
@@ -222,7 +222,7 @@ static int aa_read_header(AVFormatContext *s)
     c->content_end = start + largest_size;
 
     while ((chapter_pos = avio_tell(pb)) >= 0 && chapter_pos < c->content_end) {
-        int chapter_idx = s->nb_chapters;
+        unsigned chapter_idx = s->nb_chapters;
         uint32_t chapter_size = avio_rb32(pb);
         if (chapter_size == 0 || avio_feof(pb))
             break;
index f781c1c118f469c33cad00fbd170cd4032ffec2e..822aa4c6314f7e3c96499d7871f6622387d763a5 100644 (file)
@@ -1188,7 +1188,11 @@ typedef struct AVProgram {
                                          change dynamically at runtime. */
 
 typedef struct AVChapter {
+#if FF_API_CHAPTER_ID_INT
     int id;                 ///< unique ID to identify the chapter
+#else
+    int64_t id;             ///< unique ID to identify the chapter
+#endif
     AVRational time_base;   ///< time base in which the start/end timestamps are specified
     int64_t start, end;     ///< chapter start/end time in time_base units
     AVDictionary *metadata;
index 96902b818cb4f153a1e33b7bca7d4dcccb69891a..3c6b2921c1e2167f0560131501c1bc9b80f5699d 100644 (file)
@@ -560,7 +560,11 @@ void ff_configure_buffers_for_index(AVFormatContext *s, int64_t time_tolerance);
  *
  * @return AVChapter or NULL on error
  */
+#if FF_API_CHAPTER_ID_INT
 AVChapter *avpriv_new_chapter(AVFormatContext *s, int id, AVRational time_base,
+#else
+AVChapter *avpriv_new_chapter(AVFormatContext *s, int64_t id, AVRational time_base,
+#endif
                               int64_t start, int64_t end, const char *title);
 
 /**
index 012da9e538251238b8f9eeff120151acad5698c2..bbf231f2a46900c309fa2e632c518f25a86372d8 100644 (file)
@@ -1669,7 +1669,11 @@ static int mkv_write_chapters(AVFormatContext *s)
         int64_t chapterstart = av_rescale_q(c->start, c->time_base, scale);
         int64_t chapterend   = av_rescale_q(c->end,   c->time_base, scale);
         const AVDictionaryEntry *t;
+#if FF_API_CHAPTER_ID_INT
         uint64_t uid = create_new_ids ? i + 1ULL : (uint32_t)c->id;
+#else
+        uint64_t uid = create_new_ids ? i + 1ULL : c->id;
+#endif
         if (chapterstart < 0 || chapterstart > chapterend || chapterend < 0) {
             av_log(s, AV_LOG_ERROR,
                    "Invalid chapter start (%"PRId64") or end (%"PRId64").\n",
index ebb062377d8a89479a56ebf9cc1428edd9bf060d..d1f3496990c14d4e3109c53e199d9d3e0745d983 100644 (file)
@@ -489,8 +489,8 @@ static int decode_info_header(NUTContext *nut)
     AVIOContext *bc    = s->pb;
     uint64_t tmp, chapter_start, chapter_len;
     unsigned int stream_id_plus1, count;
-    int chapter_id, i, ret = 0;
-    int64_t value, end;
+    int i, ret = 0;
+    int64_t chapter_id, value, end;
     char name[256], str_value[1024], type_str[256];
     const char *type;
     int *event_flags        = NULL;
index a73f944e6e797fcd3c08879025c27425f6dd21d1..295e676c9c4a2603ce2418bb74e14a7462260bbe 100644 (file)
@@ -4626,7 +4626,11 @@ AVProgram *av_new_program(AVFormatContext *ac, int id)
     return program;
 }
 
+#if FF_API_CHAPTER_ID_INT
 AVChapter *avpriv_new_chapter(AVFormatContext *s, int id, AVRational time_base,
+#else
+AVChapter *avpriv_new_chapter(AVFormatContext *s, int64_t id, AVRational time_base,
+#endif
                               int64_t start, int64_t end, const char *title)
 {
     AVChapter *chapter = NULL;
index e43754b069d4cdc78f2fcfbbbb04a449f1893417..ca1cd1a920edf5432685dd914e94663600790326 100644 (file)
@@ -32,7 +32,7 @@
 // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium)
 // Also please add any ticket numbers that you believe might be affected here
 #define LIBAVFORMAT_VERSION_MAJOR  58
-#define LIBAVFORMAT_VERSION_MINOR  74
+#define LIBAVFORMAT_VERSION_MINOR  75
 #define LIBAVFORMAT_VERSION_MICRO 100
 
 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
 #ifndef FF_API_DEMUXER_OPEN
 #define FF_API_DEMUXER_OPEN             (LIBAVFORMAT_VERSION_MAJOR < 59)
 #endif
+#ifndef FF_API_CHAPTER_ID_INT
+#define FF_API_CHAPTER_ID_INT           (LIBAVFORMAT_VERSION_MAJOR < 59)
+#endif
 #ifndef FF_API_LAVF_PRIV_OPT
 #define FF_API_LAVF_PRIV_OPT            (LIBAVFORMAT_VERSION_MAJOR < 60)
 #endif