Commit 39bbf77a authored by michael's avatar michael

Make ff_new_chapter() return AVChapter instead of int so its consistant with

av_new_program() and its simpler to set other fields in AVChapter which arent
set by ff_new_chapter().


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@13262 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 7ed1f2f5
...@@ -764,8 +764,10 @@ AVProgram *av_new_program(AVFormatContext *s, int id); ...@@ -764,8 +764,10 @@ AVProgram *av_new_program(AVFormatContext *s, int id);
* @param start chapter start time in AV_TIME_BASE units * @param start chapter start time in AV_TIME_BASE units
* @param end chapter end time in AV_TIME_BASE units * @param end chapter end time in AV_TIME_BASE units
* @param title chapter title * @param title chapter title
*
* @return AVChapter or NULL if error.
*/ */
int ff_new_chapter(AVFormatContext *s, int id, int64_t start, int64_t end, const char *title); AVChapter *ff_new_chapter(AVFormatContext *s, int id, int64_t start, int64_t end, const char *title);
/** /**
* Set the pts for a given stream. * Set the pts for a given stream.
......
...@@ -2257,7 +2257,8 @@ matroska_parse_chapters(AVFormatContext *s) ...@@ -2257,7 +2257,8 @@ matroska_parse_chapters(AVFormatContext *s)
start = start * AV_TIME_BASE / 1000000000; start = start * AV_TIME_BASE / 1000000000;
if (end != AV_NOPTS_VALUE) if (end != AV_NOPTS_VALUE)
end = end * AV_TIME_BASE / 1000000000; end = end * AV_TIME_BASE / 1000000000;
res = ff_new_chapter(s, uid, start, end, title); if(!ff_new_chapter(s, uid, start, end, title))
res= AVERROR(ENOMEM);
} }
av_free(title); av_free(title);
break; break;
......
...@@ -2234,7 +2234,7 @@ void av_set_program_name(AVProgram *program, char *provider_name, char *name) ...@@ -2234,7 +2234,7 @@ void av_set_program_name(AVProgram *program, char *provider_name, char *name)
} }
} }
int ff_new_chapter(AVFormatContext *s, int id, int64_t start, int64_t end, const char *title) AVChapter *ff_new_chapter(AVFormatContext *s, int id, int64_t start, int64_t end, const char *title)
{ {
AVChapter *chapter = NULL; AVChapter *chapter = NULL;
int i; int i;
...@@ -2246,7 +2246,7 @@ int ff_new_chapter(AVFormatContext *s, int id, int64_t start, int64_t end, const ...@@ -2246,7 +2246,7 @@ int ff_new_chapter(AVFormatContext *s, int id, int64_t start, int64_t end, const
if(!chapter){ if(!chapter){
chapter= av_mallocz(sizeof(AVChapter)); chapter= av_mallocz(sizeof(AVChapter));
if(!chapter) if(!chapter)
return AVERROR(ENOMEM); return NULL;
dynarray_add(&s->chapters, &s->nb_chapters, chapter); dynarray_add(&s->chapters, &s->nb_chapters, chapter);
} }
if(chapter->title) if(chapter->title)
...@@ -2256,7 +2256,7 @@ int ff_new_chapter(AVFormatContext *s, int id, int64_t start, int64_t end, const ...@@ -2256,7 +2256,7 @@ int ff_new_chapter(AVFormatContext *s, int id, int64_t start, int64_t end, const
chapter->start = start; chapter->start = start;
chapter->end = end; chapter->end = end;
return 0; return chapter;
} }
/************************************************************/ /************************************************************/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment