mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-31 04:26:37 +08:00
avformat/utils: Move avpriv_new_chapter to demux_utils.c
It is demuxer-only: Muxers deal only with chapters given to them; they don't create any of their own. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
@@ -694,47 +694,6 @@ AVProgram *av_new_program(AVFormatContext *ac, int id)
|
||||
return program;
|
||||
}
|
||||
|
||||
AVChapter *avpriv_new_chapter(AVFormatContext *s, int64_t id, AVRational time_base,
|
||||
int64_t start, int64_t end, const char *title)
|
||||
{
|
||||
FFFormatContext *const si = ffformatcontext(s);
|
||||
AVChapter *chapter = NULL;
|
||||
int ret;
|
||||
|
||||
if (end != AV_NOPTS_VALUE && start > end) {
|
||||
av_log(s, AV_LOG_ERROR, "Chapter end time %"PRId64" before start %"PRId64"\n", end, start);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!s->nb_chapters) {
|
||||
si->chapter_ids_monotonic = 1;
|
||||
} else if (!si->chapter_ids_monotonic || s->chapters[s->nb_chapters-1]->id >= id) {
|
||||
for (unsigned i = 0; i < s->nb_chapters; i++)
|
||||
if (s->chapters[i]->id == id)
|
||||
chapter = s->chapters[i];
|
||||
if (!chapter)
|
||||
si->chapter_ids_monotonic = 0;
|
||||
}
|
||||
|
||||
if (!chapter) {
|
||||
chapter = av_mallocz(sizeof(AVChapter));
|
||||
if (!chapter)
|
||||
return NULL;
|
||||
ret = av_dynarray_add_nofree(&s->chapters, &s->nb_chapters, chapter);
|
||||
if (ret < 0) {
|
||||
av_free(chapter);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
av_dict_set(&chapter->metadata, "title", title, 0);
|
||||
chapter->id = id;
|
||||
chapter->time_base = time_base;
|
||||
chapter->start = start;
|
||||
chapter->end = end;
|
||||
|
||||
return chapter;
|
||||
}
|
||||
|
||||
void av_program_add_stream_index(AVFormatContext *ac, int progid, unsigned idx)
|
||||
{
|
||||
AVProgram *program = NULL;
|
||||
|
||||
Reference in New Issue
Block a user