[FFmpeg-soc] [soc]: r5277 - in concat/libavformat: Makefile.diff avplaylist.c avplaylist.h concatgen.c m3u.c playlist.c playlist.h pls.c utils.c.diff xspf.c

gkovacs subversion at mplayerhq.hu
Wed Aug 26 03:01:06 CEST 2009


Author: gkovacs
Date: Wed Aug 26 03:01:06 2009
New Revision: 5277

Log:
move playlist_populate_context out of public header

Modified:
   concat/libavformat/Makefile.diff
   concat/libavformat/avplaylist.c
   concat/libavformat/avplaylist.h
   concat/libavformat/concatgen.c
   concat/libavformat/m3u.c
   concat/libavformat/playlist.c
   concat/libavformat/playlist.h
   concat/libavformat/pls.c
   concat/libavformat/utils.c.diff
   concat/libavformat/xspf.c

Modified: concat/libavformat/Makefile.diff
==============================================================================
--- concat/libavformat/Makefile.diff	Wed Aug 26 02:40:18 2009	(r5276)
+++ concat/libavformat/Makefile.diff	Wed Aug 26 03:01:06 2009	(r5277)
@@ -1,5 +1,5 @@
 diff --git a/libavformat/Makefile b/libavformat/Makefile
-index 89b6ce2..7a3437f 100644
+index 89b6ce2..cc7585a 100644
 --- a/libavformat/Makefile
 +++ b/libavformat/Makefile
 @@ -3,7 +3,7 @@ include $(SUBDIR)../config.mak
@@ -15,7 +15,7 @@ index 89b6ce2..7a3437f 100644
  OBJS-$(CONFIG_BFI_DEMUXER)               += bfi.o
  OBJS-$(CONFIG_C93_DEMUXER)               += c93.o vocdec.o voc.o
  OBJS-$(CONFIG_CAVSVIDEO_DEMUXER)         += raw.o
-+OBJS-$(CONFIG_CONCAT_DEMUXER)            += concat.o avplaylist.o concatgen.o
++OBJS-$(CONFIG_CONCAT_DEMUXER)            += concat.o avplaylist.o playlist.o concatgen.o
  OBJS-$(CONFIG_CRC_MUXER)                 += crcenc.o
  OBJS-$(CONFIG_DAUD_DEMUXER)              += daud.o
  OBJS-$(CONFIG_DAUD_MUXER)                += daud.o
@@ -23,7 +23,7 @@ index 89b6ce2..7a3437f 100644
  OBJS-$(CONFIG_IPMOVIE_DEMUXER)           += ipmovie.o
  OBJS-$(CONFIG_ISS_DEMUXER)               += iss.o
  OBJS-$(CONFIG_LMLM4_DEMUXER)             += lmlm4.o
-+OBJS-$(CONFIG_M3U_DEMUXER)               += m3u.o avplaylist.o concatgen.o
++OBJS-$(CONFIG_M3U_DEMUXER)               += m3u.o avplaylist.o playlist.o concatgen.o
  OBJS-$(CONFIG_M4V_DEMUXER)               += raw.o
  OBJS-$(CONFIG_M4V_MUXER)                 += raw.o
  OBJS-$(CONFIG_MATROSKA_DEMUXER)          += matroskadec.o matroska.o riff.o isom.o
@@ -31,7 +31,7 @@ index 89b6ce2..7a3437f 100644
  OBJS-$(CONFIG_PCM_U32LE_MUXER)           += raw.o
  OBJS-$(CONFIG_PCM_U8_DEMUXER)            += raw.o
  OBJS-$(CONFIG_PCM_U8_MUXER)              += raw.o
-+OBJS-$(CONFIG_PLS_DEMUXER)               += pls.o avplaylist.o concatgen.o
++OBJS-$(CONFIG_PLS_DEMUXER)               += pls.o avplaylist.o playlist.o concatgen.o
  OBJS-$(CONFIG_PVA_DEMUXER)               += pva.o
  OBJS-$(CONFIG_QCP_DEMUXER)               += qcp.o
  OBJS-$(CONFIG_R3D_DEMUXER)               += r3d.o

Modified: concat/libavformat/avplaylist.c
==============================================================================
--- concat/libavformat/avplaylist.c	Wed Aug 26 02:40:18 2009	(r5276)
+++ concat/libavformat/avplaylist.c	Wed Aug 26 03:01:06 2009	(r5277)
@@ -30,12 +30,12 @@
  *  support for playlist formats.
  */
 
-#include "libavformat/avplaylist.h"
+#include "avplaylist.h"
 #include "riff.h"
 #include "libavutil/avstring.h"
 #include "internal.h"
 #include "concat.h"
-#include "avplaylist.h"
+#include "playlist.h"
 
 AVFormatContext *av_playlist_alloc_formatcontext(char *filename)
 {
@@ -61,26 +61,6 @@ AVFormatContext *av_playlist_alloc_forma
     return ic;
 }
 
-int av_playlist_populate_context(AVPlaylistContext *ctx, int pe_curidx)
-{
-    AVFormatContext **formatcontext_list_tmp = av_realloc(ctx->formatcontext_list, sizeof(*(ctx->formatcontext_list)) * (pe_curidx+2));
-    if (!formatcontext_list_tmp) {
-        av_log(NULL, AV_LOG_ERROR, "av_realloc error in av_playlist_populate_context\n");
-        av_free(ctx->formatcontext_list);
-        return AVERROR_NOMEM;
-    } else
-        ctx->formatcontext_list = formatcontext_list_tmp;
-    ctx->formatcontext_list[pe_curidx+1] = NULL;
-    if (!(ctx->formatcontext_list[pe_curidx] = av_playlist_alloc_formatcontext(ctx->flist[pe_curidx])))
-        return AVERROR_NOFMT;
-    ctx->nb_streams_list[pe_curidx] = ctx->formatcontext_list[pe_curidx]->nb_streams;
-    if (pe_curidx > 0)
-        ctx->durations[pe_curidx] = ctx->durations[pe_curidx - 1] + ctx->formatcontext_list[pe_curidx]->duration;
-    else
-        ctx->durations[pe_curidx] = 0;
-    return 0;
-}
-
 int av_playlist_set_streams(AVFormatContext *s)
 {
     int i;

Modified: concat/libavformat/avplaylist.h
==============================================================================
--- concat/libavformat/avplaylist.h	Wed Aug 26 02:40:18 2009	(r5276)
+++ concat/libavformat/avplaylist.h	Wed Aug 26 03:01:06 2009	(r5277)
@@ -54,13 +54,6 @@ typedef struct AVPlaylistContext {
  */
 AVFormatContext *av_playlist_alloc_formatcontext(char *filename);
 
-/** @brief Opens the playlist element with the specified index from the AVPlaylistContext.
- *  @param ctx AVPlaylistContext containing the desired playlist element.
- *  @param pe_curidx Index of the playlist element to be opened.
- *  @return Returns 0 upon success, or negative upon failure.
- */
-int av_playlist_populate_context(AVPlaylistContext *ctx, int pe_curidx);
-
 /** @brief Sets the master concat-type demuxer's streams to those of its currently opened playlist element.
  *  @param s AVFormatContext of the concat-type demuxer, which contains the AVPlaylistContext and substreams.
  *  @return Returns 0 upon success, or negative upon failure.

Modified: concat/libavformat/concatgen.c
==============================================================================
--- concat/libavformat/concatgen.c	Wed Aug 26 02:40:18 2009	(r5276)
+++ concat/libavformat/concatgen.c	Wed Aug 26 03:01:06 2009	(r5277)
@@ -32,6 +32,7 @@
 #include "concatgen.h"
 #include "avformat.h"
 #include "avplaylist.h"
+#include "playlist.h"
 
 int ff_concatgen_read_packet(AVFormatContext *s,
                              AVPacket *pkt)
@@ -80,7 +81,7 @@ int ff_concatgen_read_packet(AVFormatCon
                 //ctx->pe_curidx = av_playlist_stream_index_from_time(ctx,
                                                                     //av_playlist_time_offset(ctx->durations, ctx->pe_curidx),
                                                                     //NULL);
-                if (av_playlist_populate_context(ctx, ctx->pe_curidx) < 0) {
+                if (ff_playlist_populate_context(ctx, ctx->pe_curidx) < 0) {
                     av_log(NULL, AV_LOG_ERROR, "Failed to switch to AVFormatContext %d\n", ctx->pe_curidx);
                     break;
                 }
@@ -119,7 +120,7 @@ int ff_concatgen_read_seek(AVFormatConte
     ctx->pe_curidx = av_playlist_stream_index_from_time(ctx,
                                                         pts_avtimebase,
                                                         &localpts_avtimebase);
-    err = av_playlist_populate_context(ctx, ctx->pe_curidx);
+    err = ff_playlist_populate_context(ctx, ctx->pe_curidx);
     if (err < 0) {
         av_log(NULL, AV_LOG_ERROR, "Failed to switch to AVFormatContext %d\n", ctx->pe_curidx);
         return err;

Modified: concat/libavformat/m3u.c
==============================================================================
--- concat/libavformat/m3u.c	Wed Aug 26 02:40:18 2009	(r5276)
+++ concat/libavformat/m3u.c	Wed Aug 26 03:01:06 2009	(r5277)
@@ -29,6 +29,7 @@
 #include "riff.h"
 #include "libavutil/avstring.h"
 #include "internal.h"
+#include "playlist.h"
 
 /* The ffmpeg codecs we support, and the IDs they have in the file */
 static const AVCodecTag codec_m3u_tags[] = {
@@ -100,7 +101,7 @@ static int m3u_read_header(AVFormatConte
     av_playlist_add_filelist(ctx, flist, flist_len);
     av_free(flist);
     s->priv_data = ctx;
-    av_playlist_populate_context(ctx, ctx->pe_curidx);
+    ff_playlist_populate_context(ctx, ctx->pe_curidx);
     av_playlist_set_streams(s);
     return 0;
 }

Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c	Wed Aug 26 02:40:18 2009	(r5276)
+++ concat/libavformat/playlist.c	Wed Aug 26 03:01:06 2009	(r5277)
@@ -28,3 +28,24 @@
  *  The public playlist API can be found in avplaylist.h
  */
 
+#include "playlist.h"
+
+int ff_playlist_populate_context(AVPlaylistContext *ctx, int pe_curidx)
+{
+    AVFormatContext **formatcontext_list_tmp = av_realloc(ctx->formatcontext_list, sizeof(*(ctx->formatcontext_list)) * (pe_curidx+2));
+    if (!formatcontext_list_tmp) {
+        av_log(NULL, AV_LOG_ERROR, "av_realloc error in av_playlist_populate_context\n");
+        av_free(ctx->formatcontext_list);
+        return AVERROR_NOMEM;
+    } else
+        ctx->formatcontext_list = formatcontext_list_tmp;
+    ctx->formatcontext_list[pe_curidx+1] = NULL;
+    if (!(ctx->formatcontext_list[pe_curidx] = av_playlist_alloc_formatcontext(ctx->flist[pe_curidx])))
+        return AVERROR_NOFMT;
+    ctx->nb_streams_list[pe_curidx] = ctx->formatcontext_list[pe_curidx]->nb_streams;
+    if (pe_curidx > 0)
+        ctx->durations[pe_curidx] = ctx->durations[pe_curidx - 1] + ctx->formatcontext_list[pe_curidx]->duration;
+    else
+        ctx->durations[pe_curidx] = 0;
+    return 0;
+}

Modified: concat/libavformat/playlist.h
==============================================================================
--- concat/libavformat/playlist.h	Wed Aug 26 02:40:18 2009	(r5276)
+++ concat/libavformat/playlist.h	Wed Aug 26 03:01:06 2009	(r5277)
@@ -31,7 +31,14 @@
 #ifndef AVFORMAT_PLAYLIST_H
 #define AVFORMAT_PLAYLIST_H
 
+#include "avplaylist.h"
 
+/** @brief Opens the playlist element with the specified index from the AVPlaylistContext.
+ *  @param ctx AVPlaylistContext containing the desired playlist element.
+ *  @param pe_curidx Index of the playlist element to be opened.
+ *  @return Returns 0 upon success, or negative upon failure.
+ */
+int ff_playlist_populate_context(AVPlaylistContext *ctx, int pe_curidx);
 
 #endif /* AVFORMAT_PLAYLIST_H */
 

Modified: concat/libavformat/pls.c
==============================================================================
--- concat/libavformat/pls.c	Wed Aug 26 02:40:18 2009	(r5276)
+++ concat/libavformat/pls.c	Wed Aug 26 03:01:06 2009	(r5277)
@@ -29,6 +29,7 @@
 #include "riff.h"
 #include "libavutil/avstring.h"
 #include "internal.h"
+#include "playlist.h"
 
 /* The ffmpeg codecs we support, and the IDs they have in the file */
 static const AVCodecTag codec_pls_tags[] = {
@@ -119,7 +120,7 @@ static int pls_read_header(AVFormatConte
     av_playlist_add_filelist(ctx, flist, flist_len);
     av_free(flist);
     s->priv_data = ctx;
-    av_playlist_populate_context(ctx, ctx->pe_curidx);
+    ff_playlist_populate_context(ctx, ctx->pe_curidx);
     av_playlist_set_streams(s);
     return 0;
 }

Modified: concat/libavformat/utils.c.diff
==============================================================================
--- concat/libavformat/utils.c.diff	Wed Aug 26 02:40:18 2009	(r5276)
+++ concat/libavformat/utils.c.diff	Wed Aug 26 03:01:06 2009	(r5277)
@@ -1,16 +1,17 @@
 diff --git a/libavformat/utils.c b/libavformat/utils.c
-index 4cec286..2a13b4c 100644
+index 4cec286..c5d2347 100644
 --- a/libavformat/utils.c
 +++ b/libavformat/utils.c
-@@ -27,6 +27,7 @@
+@@ -27,6 +27,8 @@
  #include <sys/time.h>
  #include <time.h>
  #include <strings.h>
 +#include "libavformat/avplaylist.h"
++#include "libavformat/playlist.h"
  
  #undef NDEBUG
  #include <assert.h>
-@@ -432,7 +433,8 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
+@@ -432,7 +434,8 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
                         int buf_size,
                         AVFormatParameters *ap)
  {
@@ -20,7 +21,7 @@ index 4cec286..2a13b4c 100644
      AVProbeData probe_data, *pd = &probe_data;
      ByteIOContext *pb = NULL;
  
-@@ -447,6 +449,23 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
+@@ -447,6 +450,23 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
          fmt = av_probe_input_format(pd, 0);
      }
  
@@ -33,7 +34,7 @@ index 4cec286..2a13b4c 100644
 +                av_log(ic, AV_LOG_DEBUG, "Generating playlist from %s\n", filename);
 +                av_playlist_add_filelist(playlist_ctx, flist, flist_len);
 +                av_strlcpy(ic->filename, filename, sizeof(ic->filename));
-+                av_playlist_populate_context(playlist_ctx, playlist_ctx->pe_curidx);
++                ff_playlist_populate_context(playlist_ctx, playlist_ctx->pe_curidx);
 +                av_playlist_set_streams(ic);
 +                *ic_ptr = ic;
 +                return 0;

Modified: concat/libavformat/xspf.c
==============================================================================
--- concat/libavformat/xspf.c	Wed Aug 26 02:40:18 2009	(r5276)
+++ concat/libavformat/xspf.c	Wed Aug 26 03:01:06 2009	(r5277)
@@ -29,6 +29,7 @@
 #include "riff.h"
 #include "libavutil/avstring.h"
 #include "internal.h"
+#include "playlist.h"
 
 /* The ffmpeg codecs we support, and the IDs they have in the file */
 static const AVCodecTag codec_xspf_tags[] = {
@@ -142,7 +143,7 @@ static int xspf_read_header(AVFormatCont
     av_playlist_add_filelist(ctx, flist, flist_len);
     av_free(flist);
     s->priv_data = ctx;
-    av_playlist_populate_context(ctx, ctx->pe_curidx);
+    ff_playlist_populate_context(ctx, ctx->pe_curidx);
     av_playlist_set_streams(s);
     return 0;
 }


More information about the FFmpeg-soc mailing list