Message ID | CADxeRwnVPwsjCOuC09cVeZbim7fN-inr0KP-pCi=ZYzj2tgWSg@mail.gmail.com |
---|---|
State | Changes Requested |
Headers | show |
2016-09-08 15:33 GMT+02:00 Steven Liu <lingjiujianke@gmail.com>: > - { "initial_offset", "set initial timestamp offset", > OFFSET(initial_offset), AV_OPT_TYPE_DURATION, > {.i64 = 0}, -INT64_MAX, INT64_MAX, E }, You generally cannot simply remove options from FFmpeg. (I did not look if the option is very new or imposes a security issue or if there is another reason that makes the removal acceptable.) Alternatives are to ignore the option (instead of failing), only print a warning or make sure that the option still works if the new / general option isn't used. I don't know which is best here but command lines that used to work should not suddenly start to fail. Carl Eugen
diff --git a/libavformat/segment.c b/libavformat/segment.c index bf29ef8..2fc380e 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -114,7 +114,6 @@ typedef struct SegmentContext { char *header_filename; ///< filename to write the output header to int reset_timestamps; ///< reset timestamps at the begin of each segment - int64_t initial_offset; ///< initial timestamps offset, expressed in microseconds char *reference_stream_specifier; ///< reference stream specifier
ffmpeg have a generic solution working with all muxer named output_ts_offset Signed-off-by: LiuQi <liuqi@gosun.com> --- libavformat/segment.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) int reference_stream_index; int break_non_keyframes; @@ -802,7 +801,7 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt) { SegmentContext *seg = s->priv_data; AVStream *st = s->streams[pkt->stream_index]; - int64_t end_pts = INT64_MAX, offset; + int64_t end_pts = INT64_MAX; int start_frame = INT_MAX; int ret; struct tm ti; @@ -888,19 +887,7 @@ calc_times: av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base), av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base)); - /* compute new timestamps */ - offset = av_rescale_q(seg->initial_offset - (seg->reset_timestamps ? seg->cur_entry.start_pts : 0), - AV_TIME_BASE_Q, st->time_base); - if (pkt->pts != AV_NOPTS_VALUE) - pkt->pts += offset; - if (pkt->dts != AV_NOPTS_VALUE) - pkt->dts += offset; - - av_log(s, AV_LOG_DEBUG, " -> pts:%s pts_time:%s dts:%s dts_time:%s\n", - av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, &st->time_base), - av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, &st->time_base)); - - ret = ff_write_chained(seg->avf, pkt->stream_index, pkt, s, seg->initial_offset || seg->reset_timestamps); + ret = ff_write_chained(seg->avf, pkt->stream_index, pkt, s, seg->reset_timestamps); fail: if (pkt->stream_index == seg->reference_stream_index) { @@ -998,7 +985,6 @@ static const AVOption options[] = { { "individual_header_trailer", "write header/trailer to each segment", OFFSET(individual_header_trailer), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, E }, { "write_header_trailer", "write a header to the first segment and a trailer to the last one", OFFSET(write_header_trailer), AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, E }, { "reset_timestamps", "reset timestamps at the begin of each segment", OFFSET(reset_timestamps), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, E }, - { "initial_offset", "set initial timestamp offset", OFFSET(initial_offset), AV_OPT_TYPE_DURATION, {.i64 = 0}, -INT64_MAX, INT64_MAX, E }, { "write_empty_segments", "allow writing empty 'filler' segments", OFFSET(write_empty), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, E }, { NULL }, };