diff options
author | Stefano Sabatini <stefasab@gmail.com> | 2013-10-15 14:54:25 +0200 |
---|---|---|
committer | Stefano Sabatini <stefasab@gmail.com> | 2013-10-15 14:55:48 +0200 |
commit | 3b9f8e7cd91919721e5d80cc66a2fbbf99171784 (patch) | |
tree | 271d038b0974102a6da36e2b13a065978bf26a53 | |
parent | ccfb550b2c5d1d2817e3b65e9fe7f7aa7b9fd555 (diff) | |
download | ffmpeg-3b9f8e7cd91919721e5d80cc66a2fbbf99171784.tar.gz |
lavf/segment: simplify segment_count update
Now segment_count mark the segment_count of the current segment.
-rw-r--r-- | libavformat/segment.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libavformat/segment.c b/libavformat/segment.c index f9289eccd6..2d42fe352b 100644 --- a/libavformat/segment.c +++ b/libavformat/segment.c @@ -187,7 +187,6 @@ static int segment_start(AVFormatContext *s, int write_header) seg->segment_idx++; if ((err = set_segment_filename(s)) < 0) return err; - seg->segment_count++; if ((err = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL)) < 0) @@ -594,7 +593,6 @@ static int seg_write_header(AVFormatContext *s) if ((ret = set_segment_filename(s)) < 0) goto fail; - seg->segment_count++; if (seg->write_header_trailer) { if ((ret = avio_open2(&oc->pb, oc->filename, AVIO_FLAG_WRITE, @@ -641,13 +639,13 @@ static int seg_write_packet(AVFormatContext *s, AVPacket *pkt) int ret; if (seg->times) { - end_pts = seg->segment_count <= seg->nb_times ? - seg->times[seg->segment_count-1] : INT64_MAX; + end_pts = seg->segment_count < seg->nb_times ? + seg->times[seg->segment_count] : INT64_MAX; } else if (seg->frames) { start_frame = seg->segment_count <= seg->nb_frames ? - seg->frames[seg->segment_count-1] : INT_MAX; + seg->frames[seg->segment_count] : INT_MAX; } else { - end_pts = seg->time * seg->segment_count; + end_pts = seg->time * (seg->segment_count+1); } av_dlog(s, "packet stream:%d pts:%s pts_time:%s is_key:%d frame:%d\n", |