diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2008-05-23 13:02:27 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2008-05-23 13:02:27 +0000 |
commit | 7a2a3e8e401d8ac6a8306e67cc164fc70b006155 (patch) | |
tree | f86ca77e5cb205b4ba524332cb2d950a78610445 /libavformat/utils.c | |
parent | 8931e7b48a96d8034dd01a5000433735c522d92a (diff) | |
download | ffmpeg-streaming-7a2a3e8e401d8ac6a8306e67cc164fc70b006155.zip ffmpeg-streaming-7a2a3e8e401d8ac6a8306e67cc164fc70b006155.tar.gz |
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
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 66f26cc..aa8a117 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -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; } |