Note that convergence_duration had another meaning, one which was in practice never used. The only real use for it was a 64 bit replacement for the duration field. It's better just to make duration 64 bits, and to get rid of it. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>tags/n3.0
| @@ -13,6 +13,9 @@ libavutil: 2015-08-28 | |||||
| API changes, most recent first: | API changes, most recent first: | ||||
| 2015-xx-xx - xxxxxxx - lavc 57.0.0 - avcodec.h | |||||
| Change type of AVPacket.duration from int to int64_t. | |||||
| 2015-xx-xx - xxxxxxx - lavc 57.2.0 - d3d11va.h | 2015-xx-xx - xxxxxxx - lavc 57.2.0 - d3d11va.h | ||||
| Add av_d3d11va_alloc_context(). This function must from now on be used for | Add av_d3d11va_alloc_context(). This function must from now on be used for | ||||
| allocating AVD3D11VAContext. | allocating AVD3D11VAContext. | ||||
| @@ -111,7 +111,7 @@ int ff_af_queue_add(AudioFrameQueue *afq, const AVFrame *f) | |||||
| } | } | ||||
| void ff_af_queue_remove(AudioFrameQueue *afq, int nb_samples, int64_t *pts, | void ff_af_queue_remove(AudioFrameQueue *afq, int nb_samples, int64_t *pts, | ||||
| int *duration) | |||||
| int64_t *duration) | |||||
| { | { | ||||
| int64_t out_pts = AV_NOPTS_VALUE; | int64_t out_pts = AV_NOPTS_VALUE; | ||||
| int removed_samples = 0; | int removed_samples = 0; | ||||
| @@ -78,6 +78,6 @@ int ff_af_queue_add(AudioFrameQueue *afq, const AVFrame *f); | |||||
| * @param[out] duration output packet duration | * @param[out] duration output packet duration | ||||
| */ | */ | ||||
| void ff_af_queue_remove(AudioFrameQueue *afq, int nb_samples, int64_t *pts, | void ff_af_queue_remove(AudioFrameQueue *afq, int nb_samples, int64_t *pts, | ||||
| int *duration); | |||||
| int64_t *duration); | |||||
| #endif /* AVCODEC_AUDIO_FRAME_QUEUE_H */ | #endif /* AVCODEC_AUDIO_FRAME_QUEUE_H */ | ||||
| @@ -1199,28 +1199,19 @@ typedef struct AVPacket { | |||||
| * Duration of this packet in AVStream->time_base units, 0 if unknown. | * Duration of this packet in AVStream->time_base units, 0 if unknown. | ||||
| * Equals next_pts - this_pts in presentation order. | * Equals next_pts - this_pts in presentation order. | ||||
| */ | */ | ||||
| int duration; | |||||
| int64_t duration; | |||||
| int64_t pos; ///< byte position in stream, -1 if unknown | int64_t pos; ///< byte position in stream, -1 if unknown | ||||
| #if FF_API_CONVERGENCE_DURATION | |||||
| /** | /** | ||||
| * Time difference in AVStream->time_base units from the pts of this | |||||
| * packet to the point at which the output from the decoder has converged | |||||
| * independent from the availability of previous frames. That is, the | |||||
| * frames are virtually identical no matter if decoding started from | |||||
| * the very first frame or from this keyframe. | |||||
| * Is AV_NOPTS_VALUE if unknown. | |||||
| * This field is not the display duration of the current packet. | |||||
| * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY | |||||
| * set. | |||||
| * | |||||
| * The purpose of this field is to allow seeking in streams that have no | |||||
| * keyframes in the conventional sense. It corresponds to the | |||||
| * recovery point SEI in H.264 and match_time_delta in NUT. It is also | |||||
| * essential for some types of subtitle streams to ensure that all | |||||
| * subtitles are correctly displayed after seeking. | |||||
| * @deprecated Same as the duration field, but as int64_t. This was required | |||||
| * for Matroska subtitles, whose duration values could overflow when the | |||||
| * duration field was still an int. | |||||
| */ | */ | ||||
| attribute_deprecated | |||||
| int64_t convergence_duration; | int64_t convergence_duration; | ||||
| #endif | |||||
| } AVPacket; | } AVPacket; | ||||
| #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe | #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe | ||||
| #define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted | #define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted | ||||
| @@ -3837,24 +3828,13 @@ typedef struct AVCodecParserContext { | |||||
| */ | */ | ||||
| int key_frame; | int key_frame; | ||||
| #if FF_API_CONVERGENCE_DURATION | |||||
| /** | /** | ||||
| * Time difference in stream time base units from the pts of this | |||||
| * packet to the point at which the output from the decoder has converged | |||||
| * independent from the availability of previous frames. That is, the | |||||
| * frames are virtually identical no matter if decoding started from | |||||
| * the very first frame or from this keyframe. | |||||
| * Is AV_NOPTS_VALUE if unknown. | |||||
| * This field is not the display duration of the current frame. | |||||
| * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY | |||||
| * set. | |||||
| * | |||||
| * The purpose of this field is to allow seeking in streams that have no | |||||
| * keyframes in the conventional sense. It corresponds to the | |||||
| * recovery point SEI in H.264 and match_time_delta in NUT. It is also | |||||
| * essential for some types of subtitle streams to ensure that all | |||||
| * subtitles are correctly displayed after seeking. | |||||
| * @deprecated unused | |||||
| */ | */ | ||||
| attribute_deprecated | |||||
| int64_t convergence_duration; | int64_t convergence_duration; | ||||
| #endif | |||||
| // Timestamp generation support: | // Timestamp generation support: | ||||
| /** | /** | ||||
| @@ -34,7 +34,11 @@ void av_init_packet(AVPacket *pkt) | |||||
| pkt->dts = AV_NOPTS_VALUE; | pkt->dts = AV_NOPTS_VALUE; | ||||
| pkt->pos = -1; | pkt->pos = -1; | ||||
| pkt->duration = 0; | pkt->duration = 0; | ||||
| #if FF_API_CONVERGENCE_DURATION | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| pkt->convergence_duration = 0; | pkt->convergence_duration = 0; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| pkt->flags = 0; | pkt->flags = 0; | ||||
| pkt->stream_index = 0; | pkt->stream_index = 0; | ||||
| pkt->buf = NULL; | pkt->buf = NULL; | ||||
| @@ -269,7 +273,11 @@ int av_packet_copy_props(AVPacket *dst, const AVPacket *src) | |||||
| dst->dts = src->dts; | dst->dts = src->dts; | ||||
| dst->pos = src->pos; | dst->pos = src->pos; | ||||
| dst->duration = src->duration; | dst->duration = src->duration; | ||||
| #if FF_API_CONVERGENCE_DURATION | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| dst->convergence_duration = src->convergence_duration; | dst->convergence_duration = src->convergence_duration; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| dst->flags = src->flags; | dst->flags = src->flags; | ||||
| dst->stream_index = src->stream_index; | dst->stream_index = src->stream_index; | ||||
| @@ -341,6 +349,10 @@ void av_packet_rescale_ts(AVPacket *pkt, AVRational src_tb, AVRational dst_tb) | |||||
| pkt->dts = av_rescale_q(pkt->dts, src_tb, dst_tb); | pkt->dts = av_rescale_q(pkt->dts, src_tb, dst_tb); | ||||
| if (pkt->duration > 0) | if (pkt->duration > 0) | ||||
| pkt->duration = av_rescale_q(pkt->duration, src_tb, dst_tb); | pkt->duration = av_rescale_q(pkt->duration, src_tb, dst_tb); | ||||
| #if FF_API_CONVERGENCE_DURATION | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| if (pkt->convergence_duration > 0) | if (pkt->convergence_duration > 0) | ||||
| pkt->convergence_duration = av_rescale_q(pkt->convergence_duration, src_tb, dst_tb); | pkt->convergence_duration = av_rescale_q(pkt->convergence_duration, src_tb, dst_tb); | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| } | } | ||||
| @@ -23,6 +23,7 @@ | |||||
| #include <stdint.h> | #include <stdint.h> | ||||
| #include <string.h> | #include <string.h> | ||||
| #include "libavutil/internal.h" | |||||
| #include "libavutil/mem.h" | #include "libavutil/mem.h" | ||||
| #include "internal.h" | #include "internal.h" | ||||
| @@ -86,7 +87,11 @@ found: | |||||
| s->fetch_timestamp = 1; | s->fetch_timestamp = 1; | ||||
| s->pict_type = AV_PICTURE_TYPE_I; | s->pict_type = AV_PICTURE_TYPE_I; | ||||
| s->key_frame = -1; | s->key_frame = -1; | ||||
| #if FF_API_CONVERGENCE_DURATION | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| s->convergence_duration = 0; | s->convergence_duration = 0; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| s->dts_sync_point = INT_MIN; | s->dts_sync_point = INT_MIN; | ||||
| s->dts_ref_dts_delta = INT_MIN; | s->dts_ref_dts_delta = INT_MIN; | ||||
| s->pts_dts_delta = INT_MIN; | s->pts_dts_delta = INT_MIN; | ||||
| @@ -168,5 +168,8 @@ | |||||
| #ifndef FF_API_VDPAU_PROFILE | #ifndef FF_API_VDPAU_PROFILE | ||||
| #define FF_API_VDPAU_PROFILE (LIBAVCODEC_VERSION_MAJOR < 59) | #define FF_API_VDPAU_PROFILE (LIBAVCODEC_VERSION_MAJOR < 59) | ||||
| #endif | #endif | ||||
| #ifndef FF_API_CONVERGENCE_DURATION | |||||
| #define FF_API_CONVERGENCE_DURATION (LIBAVCODEC_VERSION_MAJOR < 59) | |||||
| #endif | |||||
| #endif /* AVCODEC_VERSION_H */ | #endif /* AVCODEC_VERSION_H */ | ||||
| @@ -30,7 +30,7 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt) | |||||
| uint32_t crc = av_adler32_update(0, pkt->data, pkt->size); | uint32_t crc = av_adler32_update(0, pkt->data, pkt->size); | ||||
| char buf[256]; | char buf[256]; | ||||
| snprintf(buf, sizeof(buf), "%d, %10"PRId64", %10"PRId64", %8d, %8d, 0x%08"PRIx32"\n", | |||||
| snprintf(buf, sizeof(buf), "%d, %10"PRId64", %10"PRId64", %8"PRId64", %8d, 0x%08"PRIx32"\n", | |||||
| pkt->stream_index, pkt->dts, pkt->pts, pkt->duration, pkt->size, crc); | pkt->stream_index, pkt->dts, pkt->pts, pkt->duration, pkt->size, crc); | ||||
| avio_write(s->pb, buf, strlen(buf)); | avio_write(s->pb, buf, strlen(buf)); | ||||
| return 0; | return 0; | ||||
| @@ -2335,10 +2335,14 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska, | |||||
| else | else | ||||
| pkt->pts = timecode; | pkt->pts = timecode; | ||||
| pkt->pos = pos; | pkt->pos = pos; | ||||
| if (track->type != MATROSKA_TRACK_TYPE_SUBTITLE || st->codec->codec_id == AV_CODEC_ID_TEXT) | |||||
| pkt->duration = duration; | |||||
| #if FF_API_CONVERGENCE_DURATION | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| if (st->codec->codec_id == AV_CODEC_ID_TEXT) | if (st->codec->codec_id == AV_CODEC_ID_TEXT) | ||||
| pkt->convergence_duration = duration; | pkt->convergence_duration = duration; | ||||
| else if (track->type != MATROSKA_TRACK_TYPE_SUBTITLE) | |||||
| pkt->duration = duration; | |||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| if (st->codec->codec_id == AV_CODEC_ID_SSA) | if (st->codec->codec_id == AV_CODEC_ID_SSA) | ||||
| matroska_fix_ass_packet(matroska, pkt, duration); | matroska_fix_ass_packet(matroska, pkt, duration); | ||||
| @@ -1394,7 +1394,7 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb, | |||||
| int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts; | int64_t ts = mkv->tracks[pkt->stream_index].write_dts ? pkt->dts : pkt->pts; | ||||
| av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, " | av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, " | ||||
| "pts %" PRId64 ", dts %" PRId64 ", duration %d, flags %d\n", | |||||
| "pts %" PRId64 ", dts %" PRId64 ", duration %" PRId64 ", flags %d\n", | |||||
| avio_tell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags); | avio_tell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, flags); | ||||
| if (codec->codec_id == AV_CODEC_ID_H264 && codec->extradata_size > 0 && | if (codec->codec_id == AV_CODEC_ID_H264 && codec->extradata_size > 0 && | ||||
| (AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1)) | (AV_RB24(codec->extradata) == 1 || AV_RB32(codec->extradata) == 1)) | ||||
| @@ -1527,7 +1527,13 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt) | |||||
| } else { | } else { | ||||
| ebml_master blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, | ebml_master blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, | ||||
| mkv_blockgroup_size(pkt->size)); | mkv_blockgroup_size(pkt->size)); | ||||
| duration = pkt->convergence_duration; | |||||
| duration = pkt->duration; | |||||
| #if FF_API_CONVERGENCE_DURATION | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| if (pkt->convergence_duration) | |||||
| duration = pkt->convergence_duration; | |||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| mkv_write_block(s, pb, MATROSKA_ID_BLOCK, pkt, 0); | mkv_write_block(s, pb, MATROSKA_ID_BLOCK, pkt, 0); | ||||
| put_ebml_uint(pb, MATROSKA_ID_BLOCKDURATION, duration); | put_ebml_uint(pb, MATROSKA_ID_BLOCKDURATION, duration); | ||||
| end_ebml_master(pb, blockgroup); | end_ebml_master(pb, blockgroup); | ||||
| @@ -104,7 +104,7 @@ static int framemd5_write_packet(struct AVFormatContext *s, AVPacket *pkt) | |||||
| av_md5_init(c->md5); | av_md5_init(c->md5); | ||||
| av_md5_update(c->md5, pkt->data, pkt->size); | av_md5_update(c->md5, pkt->data, pkt->size); | ||||
| snprintf(buf, sizeof(buf) - 64, "%d, %10"PRId64", %10"PRId64", %8d, %8d, ", | |||||
| snprintf(buf, sizeof(buf) - 64, "%d, %10"PRId64", %10"PRId64", %8"PRId64", %8d, ", | |||||
| pkt->stream_index, pkt->dts, pkt->pts, pkt->duration, pkt->size); | pkt->stream_index, pkt->dts, pkt->pts, pkt->duration, pkt->size); | ||||
| md5_finish(s, buf); | md5_finish(s, buf); | ||||
| return 0; | return 0; | ||||
| @@ -3535,7 +3535,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt) | |||||
| goto retry; | goto retry; | ||||
| pkt->flags |= sample->flags & AVINDEX_KEYFRAME ? AV_PKT_FLAG_KEY : 0; | pkt->flags |= sample->flags & AVINDEX_KEYFRAME ? AV_PKT_FLAG_KEY : 0; | ||||
| pkt->pos = sample->pos; | pkt->pos = sample->pos; | ||||
| av_log(s, AV_LOG_TRACE, "stream %d, pts %"PRId64", dts %"PRId64", pos 0x%"PRIx64", duration %d\n", | |||||
| av_log(s, AV_LOG_TRACE, "stream %d, pts %"PRId64", dts %"PRId64", pos 0x%"PRIx64", duration %"PRId64"\n", | |||||
| pkt->stream_index, pkt->pts, pkt->dts, pkt->pos, pkt->duration); | pkt->stream_index, pkt->pts, pkt->dts, pkt->pos, pkt->duration); | ||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -264,7 +264,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom) | |||||
| if (st->avg_frame_rate.num) | if (st->avg_frame_rate.num) | ||||
| pkt->duration = (uint64_t)st->time_base.den* | pkt->duration = (uint64_t)st->time_base.den* | ||||
| st->avg_frame_rate.den/st->avg_frame_rate.num; | st->avg_frame_rate.den/st->avg_frame_rate.num; | ||||
| av_log(s, AV_LOG_TRACE, "pkt dts %"PRId64" duration %d\n", pkt->dts, pkt->duration); | |||||
| av_log(s, AV_LOG_TRACE, "pkt dts %"PRId64" duration %"PRId64"\n", pkt->dts, pkt->duration); | |||||
| return 0; | return 0; | ||||
| } | } | ||||
| @@ -313,7 +313,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom) | |||||
| pkt->stream_index = 1; | pkt->stream_index = 1; | ||||
| pkt->dts = dts; | pkt->dts = dts; | ||||
| pkt->duration = av_rescale(samples, st->time_base.den, st->codec->sample_rate); | pkt->duration = av_rescale(samples, st->time_base.den, st->codec->sample_rate); | ||||
| av_log(s, AV_LOG_TRACE, "pkt dts %"PRId64" duration %d samples %d sample rate %d\n", | |||||
| av_log(s, AV_LOG_TRACE, "pkt dts %"PRId64" duration %"PRId64" samples %d sample rate %d\n", | |||||
| pkt->dts, pkt->duration, samples, st->codec->sample_rate); | pkt->dts, pkt->duration, samples, st->codec->sample_rate); | ||||
| return 0; | return 0; | ||||
| @@ -735,8 +735,12 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, | |||||
| /* update flags */ | /* update flags */ | ||||
| if (is_intra_only(st->codec->codec_id)) | if (is_intra_only(st->codec->codec_id)) | ||||
| pkt->flags |= AV_PKT_FLAG_KEY; | pkt->flags |= AV_PKT_FLAG_KEY; | ||||
| #if FF_API_CONVERGENCE_DURATION | |||||
| FF_DISABLE_DEPRECATION_WARNINGS | |||||
| if (pc) | if (pc) | ||||
| pkt->convergence_duration = pc->convergence_duration; | pkt->convergence_duration = pc->convergence_duration; | ||||
| FF_ENABLE_DEPRECATION_WARNINGS | |||||
| #endif | |||||
| } | } | ||||
| static void free_packet_buffer(AVPacketList **pkt_buf, AVPacketList **pkt_buf_end) | static void free_packet_buffer(AVPacketList **pkt_buf, AVPacketList **pkt_buf_end) | ||||
| @@ -906,7 +910,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) | |||||
| if (s->debug & FF_FDEBUG_TS) | if (s->debug & FF_FDEBUG_TS) | ||||
| av_log(s, AV_LOG_DEBUG, | av_log(s, AV_LOG_DEBUG, | ||||
| "ff_read_packet stream=%d, pts=%"PRId64", dts=%"PRId64", " | "ff_read_packet stream=%d, pts=%"PRId64", dts=%"PRId64", " | ||||
| "size=%d, duration=%d, flags=%d\n", | |||||
| "size=%d, duration=%"PRId64", flags=%d\n", | |||||
| cur_pkt.stream_index, cur_pkt.pts, cur_pkt.dts, | cur_pkt.stream_index, cur_pkt.pts, cur_pkt.dts, | ||||
| cur_pkt.size, cur_pkt.duration, cur_pkt.flags); | cur_pkt.size, cur_pkt.duration, cur_pkt.flags); | ||||
| @@ -955,7 +959,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) | |||||
| if (s->debug & FF_FDEBUG_TS) | if (s->debug & FF_FDEBUG_TS) | ||||
| av_log(s, AV_LOG_DEBUG, | av_log(s, AV_LOG_DEBUG, | ||||
| "read_frame_internal stream=%d, pts=%"PRId64", dts=%"PRId64", " | "read_frame_internal stream=%d, pts=%"PRId64", dts=%"PRId64", " | ||||
| "size=%d, duration=%d, flags=%d\n", | |||||
| "size=%d, duration=%"PRId64", flags=%d\n", | |||||
| pkt->stream_index, pkt->pts, pkt->dts, | pkt->stream_index, pkt->pts, pkt->dts, | ||||
| pkt->size, pkt->duration, pkt->flags); | pkt->size, pkt->duration, pkt->flags); | ||||