[FFmpeg-soc] [soc]: r5311 - in concat/libavformat: avplaylist.c avplaylist.h

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


Author: gkovacs
Date: Wed Aug 26 20:26:54 2009
New Revision: 5311

Log:
add av_playlist_insert_playlist

Modified:
   concat/libavformat/avplaylist.c
   concat/libavformat/avplaylist.h

Modified: concat/libavformat/avplaylist.c
==============================================================================
--- concat/libavformat/avplaylist.c	Wed Aug 26 20:04:21 2009	(r5310)
+++ concat/libavformat/avplaylist.c	Wed Aug 26 20:26:54 2009	(r5311)
@@ -87,6 +87,18 @@ int av_playlist_insert_item(AVPlaylistCo
     return 0;
 }
 
+int av_playlist_insert_playlist(AVPlaylistContext *ctx, AVPlaylistContext *insert_ctx, int pos)
+{
+    int i, err;
+    for (i = 0; i < insert_ctx->pelist_size; ++i) {
+        err = av_playlist_insert_item(ctx, insert_ctx->flist[i], pos + i);
+        if (err) {
+            av_log(NULL, AV_LOG_ERROR, "failed to insert item %d to new position %d in av_playlist_insert_playlist\n", i, pos + i);
+        }
+    }
+    return 0;
+}
+
 int av_playlist_remove_item(AVPlaylistContext *ctx, int pos)
 {
     int i;

Modified: concat/libavformat/avplaylist.h
==============================================================================
--- concat/libavformat/avplaylist.h	Wed Aug 26 20:04:21 2009	(r5310)
+++ concat/libavformat/avplaylist.h	Wed Aug 26 20:26:54 2009	(r5311)
@@ -63,6 +63,16 @@ AVPlaylistContext *av_playlist_alloc(voi
  */
 int av_playlist_insert_item(AVPlaylistContext *ctx, const char *itempath, int pos);
 
+/** @brief Creates and adds AVFormatContext for all items in another playlist,
+ *  starting at the specified index and appending until the end of the other
+ *  playlist. Existing items will be shifted up in the list.
+ *  @param ctx Pre-allocated AVPlaylistContext to add elements to.
+ *  @param insert_ctx Pre-allocated AVPlaylistContext from which to add items from.
+ *  @param pos Zero-based index which the newly inserted item will occupy.
+ *  @return Returns 0 upon success, or negative upon failure.
+ */
+int av_playlist_insert_playlist(AVPlaylistContext *ctx, AVPlaylistContext *insert_ctx, int pos);
+
 /** @brief Removes AVFormatContext for item located at speified index from AVPlaylistContext.
  *  Existing items will be shifted down in the list.
  *  @param ctx Pre-allocated AVPlaylistContext to remove elements from.


More information about the FFmpeg-soc mailing list