diff --git a/libavformat/avformat.h b/libavformat/avformat.h index fd49442ed5ee573ac3f3c7764242d9402c5c5ea3..f8f35ac37db18eec98f708fa661dff06e9208747 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -776,13 +776,13 @@ AVProgram *av_new_program(AVFormatContext *s, int id); * * @param s media file handle * @param id unique id for this chapter - * @param start chapter start time in AV_TIME_BASE units - * @param end chapter end time in AV_TIME_BASE units + * @param start chapter start time in time_base units + * @param end chapter end time in time_base units * @param title chapter title * * @return AVChapter or NULL if error. */ -AVChapter *ff_new_chapter(AVFormatContext *s, int id, int64_t start, int64_t end, const char *title); +AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, int64_t start, int64_t end, const char *title); /** * Set the pts for a given stream. diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 7cbf7054f1a7b8625590d5d5956356ffd7fcdde8..6f6caa169de87a88bd51d2b48dd442299fb39b94 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2254,10 +2254,7 @@ matroska_parse_chapters(AVFormatContext *s) } if (start != AV_NOPTS_VALUE && uid != -1) { - start = start * AV_TIME_BASE / 1000000000; - if (end != AV_NOPTS_VALUE) - end = end * AV_TIME_BASE / 1000000000; - if(!ff_new_chapter(s, uid, start, end, title)) + if(!ff_new_chapter(s, uid, (AVRational){1, 1000000000}, start, end, title)) res= AVERROR(ENOMEM); } av_free(title); diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 7259a36acc31a9325813eb0c999204fbbe69d82c..0655d0fdc7312bc7494acb268585926939fae778 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -406,8 +406,9 @@ static int decode_info_header(NUTContext *nut){ if(chapter_id && !stream_id_plus1){ int64_t start= chapter_start / nut->time_base_count; - chapter= ff_new_chapter(s, chapter_id, start, start + chapter_len, NULL); - chapter->time_base= nut->time_base[chapter_start % nut->time_base_count]; + chapter= ff_new_chapter(s, chapter_id, + nut->time_base[chapter_start % nut->time_base_count], + start, start + chapter_len, NULL); } for(i=0; i<count; i++){ diff --git a/libavformat/utils.c b/libavformat/utils.c index e37577dbd7bcd3a47a14c12cd87de1a9208c127b..7faedccdcb7aaf326f82cfefca6e95c1cf53f1e2 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2246,7 +2246,7 @@ void av_set_program_name(AVProgram *program, char *provider_name, char *name) } } -AVChapter *ff_new_chapter(AVFormatContext *s, int id, int64_t start, int64_t end, const char *title) +AVChapter *ff_new_chapter(AVFormatContext *s, int id, AVRational time_base, int64_t start, int64_t end, const char *title) { AVChapter *chapter = NULL; int i; @@ -2265,6 +2265,7 @@ AVChapter *ff_new_chapter(AVFormatContext *s, int id, int64_t start, int64_t end av_free(chapter->title); chapter->title = av_strdup(title); chapter->id = id; + chapter->time_base= time_base; chapter->start = start; chapter->end = end;