[FFmpeg-soc] [soc]: r5304 - in concat/libavformat: avplaylist.c avplaylist.h
gkovacs
subversion at mplayerhq.hu
Wed Aug 26 10:30:59 CEST 2009
Author: gkovacs
Date: Wed Aug 26 10:30:58 2009
New Revision: 5304
Log:
add av_playlist_close
Modified:
concat/libavformat/avplaylist.c
concat/libavformat/avplaylist.h
Modified: concat/libavformat/avplaylist.c
==============================================================================
--- concat/libavformat/avplaylist.c Wed Aug 26 10:21:43 2009 (r5303)
+++ concat/libavformat/avplaylist.c Wed Aug 26 10:30:58 2009 (r5304)
@@ -221,3 +221,25 @@ void av_playlist_relative_paths(char **f
flist[i] = full_file_path;
}
}
+
+int av_playlist_close(AVPlaylistContext *ctx)
+{
+ int i, err;
+ while (ctx->pelist_size > 0) {
+ err = av_playlist_remove_item(ctx->pelist_size-1);
+ if (err) {
+ av_log(NULL, AV_LOG_ERROR, "failed to remove item %d from playlist", ctx->pelist_size-1);
+ return err;
+ }
+ }
+ if (ctx->flist)
+ av_free(ctx->flist);
+ if (ctx->durations)
+ av_free(ctx->durations);
+ if (ctx->nb_streams_list)
+ av_free(ctx->nb_streams_list);
+ if (ctx->formatcontext_list)
+ av_free(ctx->formatcontext_list);
+ av_free(ctx);
+ return 0;
+}
Modified: concat/libavformat/avplaylist.h
==============================================================================
--- concat/libavformat/avplaylist.h Wed Aug 26 10:21:43 2009 (r5303)
+++ concat/libavformat/avplaylist.h Wed Aug 26 10:30:58 2009 (r5304)
@@ -94,4 +94,10 @@ int av_playlist_insert_item(AVPlaylistCo
*/
int av_playlist_remove_item(AVPlaylistContext *ctx, int pos);
+/** @brief Removes all items from playlist and frees it.
+ * @param ctx Pre-allocated AVPlaylistContext to close.
+ * @return Returns 0 upon success, or negative upon failure.
+ */
+int av_playlist_close(AVPlaylistContext *ctx);
+
#endif /* AVFORMAT_AVPLAYLIST_H */
More information about the FFmpeg-soc
mailing list