[FFmpeg-soc] [soc]: r5310 - in concat/libavformat: avplaylist.c avplaylist.h m3u.c playlist.c pls.c xspf.c

gkovacs subversion at mplayerhq.hu
Wed Aug 26 20:04:21 CEST 2009


Author: gkovacs
Date: Wed Aug 26 20:04:21 2009
New Revision: 5310

Log:
add av_playlist_alloc to allow for new default non-zero values to be set in the future

Modified:
   concat/libavformat/avplaylist.c
   concat/libavformat/avplaylist.h
   concat/libavformat/m3u.c
   concat/libavformat/playlist.c
   concat/libavformat/pls.c
   concat/libavformat/xspf.c

Modified: concat/libavformat/avplaylist.c
==============================================================================
--- concat/libavformat/avplaylist.c	Wed Aug 26 19:58:29 2009	(r5309)
+++ concat/libavformat/avplaylist.c	Wed Aug 26 20:04:21 2009	(r5310)
@@ -35,6 +35,11 @@
 #include "libavutil/avstring.h"
 #include "internal.h"
 
+AVPlaylistContext *av_playlist_alloc(void)
+{
+    return av_mallocz(sizeof(AVPlaylistContext));
+}
+
 int av_playlist_insert_item(AVPlaylistContext *ctx, const char *itempath, int pos)
 {
     int i;

Modified: concat/libavformat/avplaylist.h
==============================================================================
--- concat/libavformat/avplaylist.h	Wed Aug 26 19:58:29 2009	(r5309)
+++ concat/libavformat/avplaylist.h	Wed Aug 26 20:04:21 2009	(r5310)
@@ -49,6 +49,11 @@ typedef struct AVPlaylistContext {
     AVFormatContext *master_formatcontext; /**< Parent AVFormatContext of which priv_data is this playlist. NULL if playlist is used standalone. */
 } AVPlaylistContext;
 
+/** @brief Allocates and sets default values for an empty AVPlaylistContext
+ *  @return NULL upon failure, newly allocated, empty AVPlaylistContext upon success.
+ */
+AVPlaylistContext *av_playlist_alloc(void);
+
 /** @brief Creates and adds AVFormatContext for item located at specified path to a AVPlaylistContext
  *  at specified index. Existing items will be shifted up in the list.
  *  @param ctx Pre-allocated AVPlaylistContext to add elements to.

Modified: concat/libavformat/m3u.c
==============================================================================
--- concat/libavformat/m3u.c	Wed Aug 26 19:58:29 2009	(r5309)
+++ concat/libavformat/m3u.c	Wed Aug 26 20:04:21 2009	(r5310)
@@ -93,7 +93,7 @@ static int m3u_read_header(AVFormatConte
         return AVERROR_EOF;
     }
     ff_playlist_relative_paths(flist, flist_len, dirname(s->filename));
-    ctx = av_mallocz(sizeof(*ctx));
+    ctx = av_playlist_alloc();
     if (!ctx) {
         av_log(NULL, AV_LOG_ERROR, "failed to allocate AVPlaylistContext in m3u_read_header\n");
         return AVERROR_NOMEM;

Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c	Wed Aug 26 19:58:29 2009	(r5309)
+++ concat/libavformat/playlist.c	Wed Aug 26 20:04:21 2009	(r5310)
@@ -59,7 +59,7 @@ AVFormatContext *ff_playlist_alloc_forma
 AVFormatContext *ff_playlist_alloc_concat_formatcontext(void)
 {
     AVFormatContext *ic;
-    AVPlaylistContext *ctx = av_mallocz(sizeof(*ctx));
+    AVPlaylistContext *ctx = av_playlist_alloc();
     if (!ctx) {
         av_log(NULL, AV_LOG_ERROR, "failed to allocate AVPlaylistContext in ff_playlist_alloc_concat_formatcontext\n");
         return NULL;

Modified: concat/libavformat/pls.c
==============================================================================
--- concat/libavformat/pls.c	Wed Aug 26 19:58:29 2009	(r5309)
+++ concat/libavformat/pls.c	Wed Aug 26 20:04:21 2009	(r5310)
@@ -112,7 +112,7 @@ static int pls_read_header(AVFormatConte
         return AVERROR_EOF;
     }
     ff_playlist_relative_paths(flist, flist_len, dirname(s->filename));
-    ctx = av_mallocz(sizeof(*ctx));
+    ctx = av_playlist_alloc();
     if (!ctx) {
         av_log(NULL, AV_LOG_ERROR, "failed to allocate AVPlaylistContext in pls_read_header\n");
         return AVERROR_NOMEM;

Modified: concat/libavformat/xspf.c
==============================================================================
--- concat/libavformat/xspf.c	Wed Aug 26 19:58:29 2009	(r5309)
+++ concat/libavformat/xspf.c	Wed Aug 26 20:04:21 2009	(r5310)
@@ -135,7 +135,7 @@ static int xspf_read_header(AVFormatCont
         return AVERROR_EOF;
     }
     ff_playlist_relative_paths(flist, flist_len, dirname(s->filename));
-    ctx = av_mallocz(sizeof(*ctx));
+    ctx = av_playlist_alloc();
     if (!ctx) {
         av_log(NULL, AV_LOG_ERROR, "failed to allocate AVPlaylistContext in xspf_read_header\n");
         return AVERROR_NOMEM;


More information about the FFmpeg-soc mailing list