mirror of
https://github.com/nyanmisaka/ffmpeg-rockchip.git
synced 2025-10-26 18:30:52 +08:00
Add id to AVChapter, untested (where do i find matroska files with chapters?).
Originally committed as revision 13255 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
@@ -2234,18 +2234,29 @@ void av_set_program_name(AVProgram *program, char *provider_name, char *name)
|
||||
}
|
||||
}
|
||||
|
||||
int ff_new_chapter(AVFormatContext *s, int64_t start, int64_t end, const char *title)
|
||||
int ff_new_chapter(AVFormatContext *s, int id, int64_t start, int64_t end, const char *title)
|
||||
{
|
||||
AVChapter *chapter = av_mallocz(sizeof(AVChapter));
|
||||
AVChapter *chapter = NULL;
|
||||
int i;
|
||||
|
||||
for(i=0; i<s->num_chapters; i++)
|
||||
if(s->chapters[i]->id == id)
|
||||
chapter = s->chapters[i];
|
||||
|
||||
if(!chapter){
|
||||
chapter= av_mallocz(sizeof(AVChapter));
|
||||
if(!chapter)
|
||||
return AVERROR(ENOMEM);
|
||||
dynarray_add(&s->chapters, &s->num_chapters, chapter);
|
||||
}
|
||||
if(chapter->title)
|
||||
av_free(chapter->title);
|
||||
if (title)
|
||||
chapter->title = av_strdup(title);
|
||||
chapter->id = id;
|
||||
chapter->start = start;
|
||||
chapter->end = end;
|
||||
|
||||
dynarray_add(&s->chapters, &s->num_chapters, chapter);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user