aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/segafilm.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2015-11-05 12:04:52 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2015-11-06 21:55:15 +0100
commit1e791ee3aae63122afb10cbabe86a747aea58992 (patch)
tree5281e51e06a2b8d86029f3265a9a0023cfe5339b /libavformat/segafilm.c
parentc012c6f1a8b34828a7870dc1854422934f14b79a (diff)
downloadffmpeg-1e791ee3aae63122afb10cbabe86a747aea58992.tar.gz
segafilm: set video and audio stream duration
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavformat/segafilm.c')
-rw-r--r--libavformat/segafilm.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index e9d86c18d8..bbbf7017ee 100644
--- a/libavformat/segafilm.c
+++ b/libavformat/segafilm.c
@@ -89,6 +89,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;
@@ -212,7 +213,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) {
@@ -240,6 +241,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,
@@ -248,6 +250,12 @@ 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;