summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-03-16 08:29:59 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-03-19 02:36:58 +0100
commite318438f2f30525d8baca2b5683aa9898d0c56f7 (patch)
treebdea751e87591c0635fd4c8eb04280f6556276ea /libavformat
parente1e6a5c8a515afa488faee3200666ce0f14ea5eb (diff)
avformat: Make AVChapter.id an int64_t on next major bump
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>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/aadec.c2
-rw-r--r--libavformat/avformat.h4
-rw-r--r--libavformat/internal.h4
-rw-r--r--libavformat/matroskaenc.c4
-rw-r--r--libavformat/nutdec.c4
-rw-r--r--libavformat/utils.c4
-rw-r--r--libavformat/version.h5
7 files changed, 23 insertions, 4 deletions
diff --git a/libavformat/aadec.c b/libavformat/aadec.c
index e88cdb89df..80ca2c12d7 100644
--- a/libavformat/aadec.c
+++ b/libavformat/aadec.c
@@ -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;
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index f781c1c118..822aa4c631 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -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;
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 96902b818c..3c6b2921c1 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -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);
/**
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 012da9e538..bbf231f2a4 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -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",
diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index ebb062377d..d1f3496990 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -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;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index a73f944e6e..295e676c9c 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -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;
diff --git a/libavformat/version.h b/libavformat/version.h
index e43754b069..ca1cd1a920 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -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, \
@@ -109,6 +109,9 @@
#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