comparison utils.c @ 3323:4bf98e198eec libavformat

Add id to AVChapter, untested (where do i find matroska files with chapters?).
author michael
date Fri, 23 May 2008 13:02:27 +0000
parents f63630e08b59
children 56b8145afb23
comparison
equal deleted inserted replaced
3322:97f7b77a969b 3323:4bf98e198eec
2232 program->provider_name = av_strdup(provider_name); 2232 program->provider_name = av_strdup(provider_name);
2233 program-> name = av_strdup( name); 2233 program-> name = av_strdup( name);
2234 } 2234 }
2235 } 2235 }
2236 2236
2237 int ff_new_chapter(AVFormatContext *s, int64_t start, int64_t end, const char *title) 2237 int ff_new_chapter(AVFormatContext *s, int id, int64_t start, int64_t end, const char *title)
2238 { 2238 {
2239 AVChapter *chapter = av_mallocz(sizeof(AVChapter)); 2239 AVChapter *chapter = NULL;
2240 int i;
2241
2242 for(i=0; i<s->num_chapters; i++)
2243 if(s->chapters[i]->id == id)
2244 chapter = s->chapters[i];
2245
2246 if(!chapter){
2247 chapter= av_mallocz(sizeof(AVChapter));
2240 if(!chapter) 2248 if(!chapter)
2241 return AVERROR(ENOMEM); 2249 return AVERROR(ENOMEM);
2250 dynarray_add(&s->chapters, &s->num_chapters, chapter);
2251 }
2252 if(chapter->title)
2253 av_free(chapter->title);
2242 if (title) 2254 if (title)
2243 chapter->title = av_strdup(title); 2255 chapter->title = av_strdup(title);
2256 chapter->id = id;
2244 chapter->start = start; 2257 chapter->start = start;
2245 chapter->end = end; 2258 chapter->end = end;
2246
2247 dynarray_add(&s->chapters, &s->num_chapters, chapter);
2248 2259
2249 return 0; 2260 return 0;
2250 } 2261 }
2251 2262
2252 /************************************************************/ 2263 /************************************************************/