They are internal and have no reason to exist in a public header, so rename and move them to internal.h
Signed-off-by: James Almer <jamr...@gmail.com> --- doc/APIchanges | 3 +++ libavformat/avformat.h | 11 +++++------ libavformat/internal.h | 9 ++++++++- libavformat/utils.c | 14 +++++++------- libavformat/version.h | 5 ++++- 5 files changed, 27 insertions(+), 15 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 1b25bddd43..b2f1429bc1 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -14,6 +14,9 @@ libavutil: 2021-04-27 API changes, most recent first: +2021-06-09 - xxxxxxxxxx - lavf 59.3.101 - avformat.h + Deprecated AV_PTS_WRAP_*. + 2021-06-09 - xxxxxxxxxx - lavf 59.3.100 - avformat.h Add pts_wrap_bits to AVStream diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 0d12d5b0d2..adc99d7308 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -817,12 +817,11 @@ typedef struct AVStreamInternal AVStreamInternal; #define AV_DISPOSITION_DEPENDENT 0x80000 ///< dependent audio stream (mix_type=0 in mpegts) #define AV_DISPOSITION_STILL_IMAGE 0x100000 ///< still images in video stream (still_picture_flag=1 in mpegts) -/** - * Options for behavior on timestamp wrap detection. - */ -#define AV_PTS_WRAP_IGNORE 0 ///< ignore the wrap -#define AV_PTS_WRAP_ADD_OFFSET 1 ///< add the format specific offset on wrap detection -#define AV_PTS_WRAP_SUB_OFFSET -1 ///< subtract the format specific offset on wrap detection +#if FF_API_PTS_WRAP +#define AV_PTS_WRAP_IGNORE 0 +#define AV_PTS_WRAP_ADD_OFFSET 1 +#define AV_PTS_WRAP_SUB_OFFSET -1 +#endif /** * Stream structure. diff --git a/libavformat/internal.h b/libavformat/internal.h index fee70e8e3d..7634b64124 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -167,6 +167,13 @@ struct AVFormatInternal { int chapter_ids_monotonic; }; +/** + * Options for behavior on timestamp wrap detection. + */ +#define FF_PTS_WRAP_IGNORE 0 ///< ignore the wrap +#define FF_PTS_WRAP_ADD_OFFSET 1 ///< add the format specific offset on wrap detection +#define FF_PTS_WRAP_SUB_OFFSET -1 ///< subtract the format specific offset on wrap detection + struct AVStreamInternal { /** * Set to 1 if the codec allows reordering, so pts can be different @@ -316,7 +323,7 @@ struct AVStreamInternal { /** * Options for behavior, when a wrap is detected. * - * Defined by AV_PTS_WRAP_ values. + * Defined by FF_PTS_WRAP_ values. * * If correction is enabled, there are two possibilities: * If the first time stamp is near the wrap point, the wrap offset diff --git a/libavformat/utils.c b/libavformat/utils.c index 5582d108d0..2c2efd45d2 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -101,12 +101,12 @@ static int is_relative(int64_t ts) { */ static int64_t wrap_timestamp(const AVStream *st, int64_t timestamp) { - if (st->internal->pts_wrap_behavior != AV_PTS_WRAP_IGNORE && st->pts_wrap_bits < 64 && + if (st->internal->pts_wrap_behavior != FF_PTS_WRAP_IGNORE && st->pts_wrap_bits < 64 && st->internal->pts_wrap_reference != AV_NOPTS_VALUE && timestamp != AV_NOPTS_VALUE) { - if (st->internal->pts_wrap_behavior == AV_PTS_WRAP_ADD_OFFSET && + if (st->internal->pts_wrap_behavior == FF_PTS_WRAP_ADD_OFFSET && timestamp < st->internal->pts_wrap_reference) return timestamp + (1ULL << st->pts_wrap_bits); - else if (st->internal->pts_wrap_behavior == AV_PTS_WRAP_SUB_OFFSET && + else if (st->internal->pts_wrap_behavior == FF_PTS_WRAP_SUB_OFFSET && timestamp >= st->internal->pts_wrap_reference) return timestamp - (1ULL << st->pts_wrap_bits); } @@ -716,7 +716,7 @@ static int update_wrap_reference(AVFormatContext *s, AVStream *st, int stream_in // if first time stamp is not more than 1/8 and 60s before the wrap point, subtract rather than add wrap offset pts_wrap_behavior = (ref < (1LL << st->pts_wrap_bits) - (1LL << st->pts_wrap_bits-3)) || (ref < (1LL << st->pts_wrap_bits) - av_rescale(60, st->time_base.den, st->time_base.num)) ? - AV_PTS_WRAP_ADD_OFFSET : AV_PTS_WRAP_SUB_OFFSET; + FF_PTS_WRAP_ADD_OFFSET : FF_PTS_WRAP_SUB_OFFSET; first_program = av_find_program_from_stream(s, NULL, stream_index); @@ -840,7 +840,7 @@ FF_ENABLE_DEPRECATION_WARNINGS st = s->streams[pkt->stream_index]; - if (update_wrap_reference(s, st, pkt->stream_index, pkt) && st->internal->pts_wrap_behavior == AV_PTS_WRAP_SUB_OFFSET) { + if (update_wrap_reference(s, st, pkt->stream_index, pkt) && st->internal->pts_wrap_behavior == FF_PTS_WRAP_SUB_OFFSET) { // correct first time stamps to negative values if (!is_relative(st->internal->first_dts)) st->internal->first_dts = wrap_timestamp(st, st->internal->first_dts); @@ -4425,7 +4425,7 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c) st->internal->first_dts = AV_NOPTS_VALUE; st->internal->probe_packets = s->max_probe_packets; st->internal->pts_wrap_reference = AV_NOPTS_VALUE; - st->internal->pts_wrap_behavior = AV_PTS_WRAP_IGNORE; + st->internal->pts_wrap_behavior = FF_PTS_WRAP_IGNORE; st->internal->last_IP_pts = AV_NOPTS_VALUE; st->internal->last_dts_for_order_check = AV_NOPTS_VALUE; @@ -4475,7 +4475,7 @@ AVProgram *av_new_program(AVFormatContext *ac, int id) program->pmt_version = -1; program->id = id; program->pts_wrap_reference = AV_NOPTS_VALUE; - program->pts_wrap_behavior = AV_PTS_WRAP_IGNORE; + program->pts_wrap_behavior = FF_PTS_WRAP_IGNORE; program->start_time = program->end_time = AV_NOPTS_VALUE; } diff --git a/libavformat/version.h b/libavformat/version.h index 7f02e18f24..8c07eb89f2 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -33,7 +33,7 @@ // Also please add any ticket numbers that you believe might be affected here #define LIBAVFORMAT_VERSION_MAJOR 59 #define LIBAVFORMAT_VERSION_MINOR 3 -#define LIBAVFORMAT_VERSION_MICRO 100 +#define LIBAVFORMAT_VERSION_MICRO 101 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ @@ -61,6 +61,9 @@ #ifndef FF_API_COMPUTE_PKT_FIELDS2 #define FF_API_COMPUTE_PKT_FIELDS2 (LIBAVFORMAT_VERSION_MAJOR < 60) #endif +#ifndef FF_API_PTS_WRAP +#define FF_API_PTS_WRAP (LIBAVFORMAT_VERSION_MAJOR < 60) +#endif #ifndef FF_API_R_FRAME_RATE -- 2.31.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".