[FFmpeg-cvslog] r13363 - trunk/libavformat/utils.c
aurel
subversion
Sat May 24 23:44:29 CEST 2008
Author: aurel
Date: Sat May 24 23:44:29 2008
New Revision: 13363
Log:
compute the end of all chapters when end is not specified in the container
Modified:
trunk/libavformat/utils.c
Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c (original)
+++ trunk/libavformat/utils.c Sat May 24 23:44:29 2008
@@ -1805,6 +1805,26 @@ enum CodecID av_codec_get_id(const AVCod
return CODEC_ID_NONE;
}
+static void compute_chapters_end(AVFormatContext *s)
+{
+ unsigned int i;
+
+ for (i=0; i+1<s->nb_chapters; i++)
+ if (s->chapters[i]->end == AV_NOPTS_VALUE) {
+ assert(s->chapters[i]->start <= s->chapters[i+1]->start);
+ assert(!av_cmp_q(s->chapters[i]->time_base, s->chapters[i+1]->time_base));
+ s->chapters[i]->end = s->chapters[i+1]->start;
+ }
+
+ if (s->nb_chapters && s->chapters[i]->end == AV_NOPTS_VALUE) {
+ assert(s->start_time != AV_NOPTS_VALUE);
+ assert(s->duration > 0);
+ s->chapters[i]->end = av_rescale_q(s->start_time + s->duration,
+ AV_TIME_BASE_Q,
+ s->chapters[i]->time_base);
+ }
+}
+
/* absolute maximum size we read until we abort */
#define MAX_READ_SIZE 5000000
@@ -2075,6 +2095,8 @@ int av_find_stream_info(AVFormatContext
url_fseek(ic->pb, ic->data_offset, SEEK_SET);
}
+ compute_chapters_end(ic);
+
#if 0
/* correct DTS for B-frame streams with no timestamps */
for(i=0;i<ic->nb_streams;i++) {
More information about the ffmpeg-cvslog
mailing list