[FFmpeg-cvslog] avformat/segafilm: set video stream duration
Paul B Mahol
git at videolan.org
Mon Nov 2 11:07:45 CET 2015
ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Oct 30 12:09:48 2015 +0100| [85a5cdb4fa74193a72585881b255c07528f8f217] | committer: Paul B Mahol
avformat/segafilm: set video stream duration
Signed-off-by: Paul B Mahol <onemda at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=85a5cdb4fa74193a72585881b255c07528f8f217
---
libavformat/segafilm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index 9c346e6..6aef48e 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -93,6 +93,7 @@ static int film_read_header(AVFormatContext *s)
int i, ret;
unsigned int data_offset;
unsigned int audio_frame_counter;
+ unsigned int video_frame_counter;
film->sample_table = NULL;
@@ -211,7 +212,7 @@ static int film_read_header(AVFormatContext *s)
avpriv_set_pts_info(st, 64, 1, film->audio_samplerate);
}
- audio_frame_counter = 0;
+ audio_frame_counter = video_frame_counter = 0;
for (i = 0; i < film->sample_count; i++) {
/* load the next sample record and transfer it to an internal struct */
if (avio_read(pb, scratch, 16) != 16) {
@@ -239,6 +240,7 @@ static int film_read_header(AVFormatContext *s)
film->sample_table[i].stream = film->video_stream_index;
film->sample_table[i].pts = AV_RB32(&scratch[8]) & 0x7FFFFFFF;
film->sample_table[i].keyframe = (scratch[8] & 0x80) ? 0 : 1;
+ video_frame_counter++;
av_add_index_entry(s->streams[film->video_stream_index],
film->sample_table[i].sample_offset,
film->sample_table[i].pts,
@@ -250,6 +252,9 @@ static int film_read_header(AVFormatContext *s)
if (film->audio_type)
s->streams[film->audio_stream_index]->duration = audio_frame_counter;
+ if (film->video_type)
+ s->streams[film->video_stream_index]->duration = video_frame_counter;
+
film->current_sample = 0;
return 0;
More information about the ffmpeg-cvslog
mailing list