diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-09-29 15:14:59 +0200 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2015-09-29 15:22:52 +0200 |
commit | b01891a9f08b9d271d75d179b3138242a958ee04 (patch) | |
tree | 6180f466be7e17e8059b3ab69a1fb5d95e776e32 /libavformat | |
parent | d3e5fbb1406995e07fccbff3ca8c1e24f57a1f7b (diff) | |
parent | 948f3c19a8bd069768ca411212aaf8c1ed96b10d (diff) | |
download | ffmpeg-b01891a9f08b9d271d75d179b3138242a958ee04.tar.gz |
Merge commit '948f3c19a8bd069768ca411212aaf8c1ed96b10d'
* commit '948f3c19a8bd069768ca411212aaf8c1ed96b10d':
lavc: Make AVPacket.duration int64, and deprecate convergence_duration
Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/framecrcenc.c | 2 | ||||
-rw-r--r-- | libavformat/jacosubdec.c | 2 | ||||
-rw-r--r-- | libavformat/matroskadec.c | 26 | ||||
-rw-r--r-- | libavformat/matroskaenc.c | 9 | ||||
-rw-r--r-- | libavformat/md5enc.c | 2 | ||||
-rw-r--r-- | libavformat/movenc.c | 2 | ||||
-rw-r--r-- | libavformat/mux.c | 2 | ||||
-rw-r--r-- | libavformat/r3d.c | 4 | ||||
-rw-r--r-- | libavformat/srtenc.c | 4 | ||||
-rw-r--r-- | libavformat/utils.c | 12 |
10 files changed, 32 insertions, 33 deletions
diff --git a/libavformat/framecrcenc.c b/libavformat/framecrcenc.c index 805b5428f9..eacbc457b1 100644 --- a/libavformat/framecrcenc.c +++ b/libavformat/framecrcenc.c @@ -47,7 +47,7 @@ static int framecrc_write_packet(struct AVFormatContext *s, AVPacket *pkt) uint32_t crc = av_adler32_update(0, pkt->data, pkt->size); char buf[256]; - snprintf(buf, sizeof(buf), "%d, %10"PRId64", %10"PRId64", %8d, %8d, 0x%08"PRIx32, + snprintf(buf, sizeof(buf), "%d, %10"PRId64", %10"PRId64", %8"PRId64", %8d, 0x%08"PRIx32, pkt->stream_index, pkt->dts, pkt->pts, pkt->duration, pkt->size, crc); if (pkt->flags != AV_PKT_FLAG_KEY) av_strlcatf(buf, sizeof(buf), ", F=0x%0X", pkt->flags); diff --git a/libavformat/jacosubdec.c b/libavformat/jacosubdec.c index 5e543634fd..0436a9328d 100644 --- a/libavformat/jacosubdec.c +++ b/libavformat/jacosubdec.c @@ -101,7 +101,7 @@ static int jacosub_read_close(AVFormatContext *s) } static const char *read_ts(JACOsubContext *jacosub, const char *buf, - int64_t *start, int *duration) + int64_t *start, int64_t *duration) { int len; unsigned hs, ms, ss, fs; // hours, minutes, seconds, frame start diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 7a094a6fb8..9db2b59d4e 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2777,29 +2777,15 @@ static int matroska_parse_frame(MatroskaDemuxContext *matroska, else pkt->pts = timecode; pkt->pos = pos; + pkt->duration = lace_duration; + +#if FF_API_CONVERGENCE_DURATION +FF_DISABLE_DEPRECATION_WARNINGS if (st->codec->codec_id == AV_CODEC_ID_SUBRIP) { - /* - * For backward compatibility. - * Historically, we have put subtitle duration - * in convergence_duration, on the off chance - * that the time_scale is less than 1us, which - * could result in a 32bit overflow on the - * normal duration field. - */ pkt->convergence_duration = lace_duration; } - - if (track->type != MATROSKA_TRACK_TYPE_SUBTITLE || - lace_duration <= INT_MAX) { - /* - * For non subtitle tracks, just store the duration - * as normal. - * - * If it's a subtitle track and duration value does - * not overflow a uint32, then also store it normally. - */ - pkt->duration = lace_duration; - } +FF_ENABLE_DEPRECATION_WARNINGS +#endif dynarray_add(&matroska->packets, &matroska->num_packets, pkt); matroska->prev_pkt = pkt; diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 2b2d034e00..c5822678c6 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -1629,7 +1629,7 @@ static void mkv_write_block(AVFormatContext *s, AVIOContext *pb, ebml_master block_group, block_additions, block_more; av_log(s, AV_LOG_DEBUG, "Writing block at offset %" PRIu64 ", size %d, " - "pts %" PRId64 ", dts %" PRId64 ", duration %d, keyframe %d\n", + "pts %" PRId64 ", dts %" PRId64 ", duration %" PRId64 ", keyframe %d\n", avio_tell(pb), pkt->size, pkt->pts, pkt->dts, pkt->duration, keyframe != 0); if (codec->codec_id == AV_CODEC_ID_H264 && codec->extradata_size > 0 && @@ -1734,7 +1734,7 @@ static int mkv_write_vtt_blocks(AVFormatContext *s, AVIOContext *pb, AVPacket *p size = id_size + 1 + settings_size + 1 + pkt->size; 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), size, pkt->pts, pkt->dts, pkt->duration, flags); blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(size)); @@ -1847,10 +1847,15 @@ static int mkv_write_packet_internal(AVFormatContext *s, AVPacket *pkt, int add_ } else { ebml_master blockgroup = start_ebml_master(pb, MATROSKA_ID_BLOCKGROUP, mkv_blockgroup_size(pkt->size)); + +#if FF_API_CONVERGENCE_DURATION +FF_DISABLE_DEPRECATION_WARNINGS /* For backward compatibility, prefer convergence_duration. */ if (pkt->convergence_duration > 0) { duration = pkt->convergence_duration; } +FF_ENABLE_DEPRECATION_WARNINGS +#endif /* All subtitle blocks are considered to be keyframes. */ mkv_write_block(s, pb, MATROSKA_ID_BLOCK, pkt, 1); put_ebml_uint(pb, MATROSKA_ID_BLOCKDURATION, duration); diff --git a/libavformat/md5enc.c b/libavformat/md5enc.c index e1a53684b6..8433be440d 100644 --- a/libavformat/md5enc.c +++ b/libavformat/md5enc.c @@ -135,7 +135,7 @@ static int framemd5_write_packet(struct AVFormatContext *s, AVPacket *pkt) av_hash_init(c->hash); av_hash_update(c->hash, 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); md5_finish(s, buf); return 0; diff --git a/libavformat/movenc.c b/libavformat/movenc.c index af03d1e4bb..5115585019 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -4317,7 +4317,7 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt) pkt->pts = AV_NOPTS_VALUE; } if (pkt->duration < 0) { - av_log(s, AV_LOG_ERROR, "Application provided duration: %d is invalid\n", pkt->duration); + av_log(s, AV_LOG_ERROR, "Application provided duration: %"PRId64" is invalid\n", pkt->duration); return AVERROR(EINVAL); } } diff --git a/libavformat/mux.c b/libavformat/mux.c index 37b5976464..c9ef490bd2 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -496,7 +496,7 @@ static int compute_pkt_fields2(AVFormatContext *s, AVStream *st, AVPacket *pkt) av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts), delay, pkt->size, pkt->stream_index); if (pkt->duration < 0 && st->codec->codec_type != AVMEDIA_TYPE_SUBTITLE) { - av_log(s, AV_LOG_WARNING, "Packet with invalid duration %d in stream %d\n", + av_log(s, AV_LOG_WARNING, "Packet with invalid duration %"PRId64" in stream %d\n", pkt->duration, pkt->stream_index); pkt->duration = 0; } diff --git a/libavformat/r3d.c b/libavformat/r3d.c index f220e3d9c0..40e2147ad3 100644 --- a/libavformat/r3d.c +++ b/libavformat/r3d.c @@ -266,7 +266,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom) if (st->avg_frame_rate.num) pkt->duration = (uint64_t)st->time_base.den* 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; } @@ -316,7 +316,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom) pkt->dts = dts; if (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); return 0; diff --git a/libavformat/srtenc.c b/libavformat/srtenc.c index 9bb83d645d..0b2a16bc4f 100644 --- a/libavformat/srtenc.c +++ b/libavformat/srtenc.c @@ -73,9 +73,13 @@ static int srt_write_packet(AVFormatContext *avf, AVPacket *pkt) y2 = AV_RL32(p + 12); } +#if FF_API_CONVERGENCE_DURATION +FF_DISABLE_DEPRECATION_WARNINGS if (d <= 0) /* For backward compatibility, fallback to convergence_duration. */ d = pkt->convergence_duration; +FF_ENABLE_DEPRECATION_WARNINGS +#endif if (s == AV_NOPTS_VALUE || d < 0) { av_log(avf, AV_LOG_WARNING, "Insufficient timestamps in event number %d.\n", srt->index); diff --git a/libavformat/utils.c b/libavformat/utils.c index 199e80be8b..dc83608b1f 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -954,7 +954,7 @@ static void update_initial_durations(AVFormatContext *s, AVStream *st, } } if (pktl && pktl->pkt.dts != st->first_dts) { - av_log(s, AV_LOG_DEBUG, "first_dts %s not matching first dts %s (pts %s, duration %d) in the queue\n", + av_log(s, AV_LOG_DEBUG, "first_dts %s not matching first dts %s (pts %s, duration %"PRId64") in the queue\n", av_ts2str(st->first_dts), av_ts2str(pktl->pkt.dts), av_ts2str(pktl->pkt.pts), pktl->pkt.duration); return; } @@ -1094,7 +1094,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, if (s->debug & FF_FDEBUG_TS) av_log(s, AV_LOG_TRACE, - "IN delayed:%d pts:%s, dts:%s cur_dts:%s st:%d pc:%p duration:%d delay:%d onein_oneout:%d\n", + "IN delayed:%d pts:%s, dts:%s cur_dts:%s st:%d pc:%p duration:%"PRId64" delay:%d onein_oneout:%d\n", presentation_delayed, av_ts2str(pkt->pts), av_ts2str(pkt->dts), av_ts2str(st->cur_dts), pkt->stream_index, pc, pkt->duration, delay, onein_oneout); @@ -1167,8 +1167,12 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st, /* update flags */ if (is_intra_only(st->codec)) pkt->flags |= AV_PKT_FLAG_KEY; +#if FF_API_CONVERGENCE_DURATION +FF_DISABLE_DEPRECATION_WARNINGS if (pc) pkt->convergence_duration = pc->convergence_duration; +FF_ENABLE_DEPRECATION_WARNINGS +#endif } static void free_packet_buffer(AVPacketList **pkt_buf, AVPacketList **pkt_buf_end) @@ -1348,7 +1352,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) } if (s->debug & FF_FDEBUG_TS) av_log(s, AV_LOG_DEBUG, - "ff_read_packet stream=%d, pts=%s, dts=%s, size=%d, duration=%d, flags=%d\n", + "ff_read_packet stream=%d, pts=%s, dts=%s, size=%d, duration=%"PRId64", flags=%d\n", cur_pkt.stream_index, av_ts2str(cur_pkt.pts), av_ts2str(cur_pkt.dts), @@ -1460,7 +1464,7 @@ static int read_frame_internal(AVFormatContext *s, AVPacket *pkt) if (s->debug & FF_FDEBUG_TS) av_log(s, AV_LOG_DEBUG, "read_frame_internal stream=%d, pts=%s, dts=%s, " - "size=%d, duration=%d, flags=%d\n", + "size=%d, duration=%"PRId64", flags=%d\n", pkt->stream_index, av_ts2str(pkt->pts), av_ts2str(pkt->dts), |