[FFmpeg-cvslog] r13262 - in trunk/libavformat: avformat.h matroskadec.c utils.c

michael subversion
Fri May 23 15:14:11 CEST 2008


Author: michael
Date: Fri May 23 15:14:11 2008
New Revision: 13262

Log:
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().


Modified:
   trunk/libavformat/avformat.h
   trunk/libavformat/matroskadec.c
   trunk/libavformat/utils.c

Modified: trunk/libavformat/avformat.h
==============================================================================
--- trunk/libavformat/avformat.h	(original)
+++ trunk/libavformat/avformat.h	Fri May 23 15:14:11 2008
@@ -764,8 +764,10 @@ AVProgram *av_new_program(AVFormatContex
  * @param start chapter start time in AV_TIME_BASE units
  * @param end chapter end time in AV_TIME_BASE units
  * @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.

Modified: trunk/libavformat/matroskadec.c
==============================================================================
--- trunk/libavformat/matroskadec.c	(original)
+++ trunk/libavformat/matroskadec.c	Fri May 23 15:14:11 2008
@@ -2257,7 +2257,8 @@ matroska_parse_chapters(AVFormatContext 
                         start = start * AV_TIME_BASE / 1000000000;
                         if (end != AV_NOPTS_VALUE)
                             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);
                     break;

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	(original)
+++ trunk/libavformat/utils.c	Fri May 23 15:14:11 2008
@@ -2234,7 +2234,7 @@ void av_set_program_name(AVProgram *prog
     }
 }
 
-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;
     int i;
@@ -2246,7 +2246,7 @@ int ff_new_chapter(AVFormatContext *s, i
     if(!chapter){
         chapter= av_mallocz(sizeof(AVChapter));
         if(!chapter)
-            return AVERROR(ENOMEM);
+            return NULL;
         dynarray_add(&s->chapters, &s->nb_chapters, chapter);
     }
     if(chapter->title)
@@ -2256,7 +2256,7 @@ int ff_new_chapter(AVFormatContext *s, i
     chapter->start = start;
     chapter->end   = end;
 
-    return 0;
+    return chapter;
 }
 
 /************************************************************/




More information about the ffmpeg-cvslog mailing list