[FFmpeg-soc] [soc]: r5278 - in concat/libavformat: 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:08:25 CEST 2009


Author: gkovacs
Date: Wed Aug 26 03:08:25 2009
New Revision: 5278

Log:
move playlist_set_streams out of public header

Modified:
   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/avplaylist.c
==============================================================================
--- concat/libavformat/avplaylist.c	Wed Aug 26 03:01:06 2009	(r5277)
+++ concat/libavformat/avplaylist.c	Wed Aug 26 03:08:25 2009	(r5278)
@@ -61,45 +61,6 @@ AVFormatContext *av_playlist_alloc_forma
     return ic;
 }
 
-int av_playlist_set_streams(AVFormatContext *s)
-{
-    int i;
-    AVPlaylistContext *ctx = s->priv_data;
-    AVFormatContext *ic = ctx->formatcontext_list[ctx->pe_curidx];
-    int offset = av_playlist_streams_offset_from_playidx(ctx, ctx->pe_curidx);
-    ic->iformat->read_header(ic, NULL);
-    for (i = 0; i < ic->nb_streams; ++i) {
-        s->streams[offset + i] = ic->streams[i];
-        ic->streams[i]->index += offset;
-        if (!ic->streams[i]->codec->codec) {
-            AVCodec *codec = avcodec_find_decoder(ic->streams[i]->codec->codec_id);
-            if (!codec) {
-                av_log(ic->streams[i]->codec,
-                       AV_LOG_ERROR,
-                       "Decoder (codec id %d) not found for input stream #%d\n",
-                       ic->streams[i]->codec->codec_id,
-                       ic->streams[i]->index);
-                return AVERROR_NOFMT;
-            }
-            if (avcodec_open(ic->streams[i]->codec, codec) < 0) {
-                av_log(ic->streams[i]->codec,
-                       AV_LOG_ERROR,
-                       "Error while opening decoder for input stream #%d\n",
-                       ic->streams[i]->index);
-                return AVERROR_IO;
-            }
-        }
-    }
-    s->nb_streams        = ic->nb_streams + offset;
-    s->packet_buffer     = ic->packet_buffer;
-    s->packet_buffer_end = ic->packet_buffer_end;
-    if (ic->iformat->read_timestamp)
-        s->iformat->read_timestamp = ff_concatgen_read_timestamp;
-    else
-        s->iformat->read_timestamp = NULL;
-    return 0;
-}
-
 AVPlaylistContext *av_playlist_get_context(AVFormatContext *ic)
 {
     if (ic && ic->iformat && ic->iformat->long_name && ic->priv_data &&

Modified: concat/libavformat/avplaylist.h
==============================================================================
--- concat/libavformat/avplaylist.h	Wed Aug 26 03:01:06 2009	(r5277)
+++ concat/libavformat/avplaylist.h	Wed Aug 26 03:08:25 2009	(r5278)
@@ -54,12 +54,6 @@ typedef struct AVPlaylistContext {
  */
 AVFormatContext *av_playlist_alloc_formatcontext(char *filename);
 
-/** @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.
- */
-int av_playlist_set_streams(AVFormatContext *s);
-
 /** @brief Allocates a new AVFormatContext for a concat-type demuxer.
  *  @return Returns NULL if failed, or AVFormatContext if succeeded.
  */

Modified: concat/libavformat/concatgen.c
==============================================================================
--- concat/libavformat/concatgen.c	Wed Aug 26 03:01:06 2009	(r5277)
+++ concat/libavformat/concatgen.c	Wed Aug 26 03:08:25 2009	(r5278)
@@ -85,7 +85,7 @@ int ff_concatgen_read_packet(AVFormatCon
                     av_log(NULL, AV_LOG_ERROR, "Failed to switch to AVFormatContext %d\n", ctx->pe_curidx);
                     break;
                 }
-                if ((av_playlist_set_streams(s)) < 0) {
+                if ((ff_playlist_set_streams(s)) < 0) {
                     av_log(NULL, AV_LOG_ERROR, "Failed to open codecs for streams in %d\n", ctx->pe_curidx);
                     break;
                 }
@@ -125,7 +125,7 @@ int ff_concatgen_read_seek(AVFormatConte
         av_log(NULL, AV_LOG_ERROR, "Failed to switch to AVFormatContext %d\n", ctx->pe_curidx);
         return err;
     }
-    err = av_playlist_set_streams(s);
+    err = ff_playlist_set_streams(s);
     if (err < 0) {
         av_log(NULL, AV_LOG_ERROR, "Failed to open codecs for streams in %d\n", ctx->pe_curidx);
         return err;

Modified: concat/libavformat/m3u.c
==============================================================================
--- concat/libavformat/m3u.c	Wed Aug 26 03:01:06 2009	(r5277)
+++ concat/libavformat/m3u.c	Wed Aug 26 03:08:25 2009	(r5278)
@@ -102,7 +102,7 @@ static int m3u_read_header(AVFormatConte
     av_free(flist);
     s->priv_data = ctx;
     ff_playlist_populate_context(ctx, ctx->pe_curidx);
-    av_playlist_set_streams(s);
+    ff_playlist_set_streams(s);
     return 0;
 }
 

Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c	Wed Aug 26 03:01:06 2009	(r5277)
+++ concat/libavformat/playlist.c	Wed Aug 26 03:08:25 2009	(r5278)
@@ -29,6 +29,7 @@
  */
 
 #include "playlist.h"
+#include "concatgen.h"
 
 int ff_playlist_populate_context(AVPlaylistContext *ctx, int pe_curidx)
 {
@@ -49,3 +50,42 @@ int ff_playlist_populate_context(AVPlayl
         ctx->durations[pe_curidx] = 0;
     return 0;
 }
+
+int ff_playlist_set_streams(AVFormatContext *s)
+{
+    int i;
+    AVPlaylistContext *ctx = s->priv_data;
+    AVFormatContext *ic = ctx->formatcontext_list[ctx->pe_curidx];
+    int offset = av_playlist_streams_offset_from_playidx(ctx, ctx->pe_curidx);
+    ic->iformat->read_header(ic, NULL);
+    for (i = 0; i < ic->nb_streams; ++i) {
+        s->streams[offset + i] = ic->streams[i];
+        ic->streams[i]->index += offset;
+        if (!ic->streams[i]->codec->codec) {
+            AVCodec *codec = avcodec_find_decoder(ic->streams[i]->codec->codec_id);
+            if (!codec) {
+                av_log(ic->streams[i]->codec,
+                       AV_LOG_ERROR,
+                       "Decoder (codec id %d) not found for input stream #%d\n",
+                       ic->streams[i]->codec->codec_id,
+                       ic->streams[i]->index);
+                return AVERROR_NOFMT;
+            }
+            if (avcodec_open(ic->streams[i]->codec, codec) < 0) {
+                av_log(ic->streams[i]->codec,
+                       AV_LOG_ERROR,
+                       "Error while opening decoder for input stream #%d\n",
+                       ic->streams[i]->index);
+                return AVERROR_IO;
+            }
+        }
+    }
+    s->nb_streams        = ic->nb_streams + offset;
+    s->packet_buffer     = ic->packet_buffer;
+    s->packet_buffer_end = ic->packet_buffer_end;
+    if (ic->iformat->read_timestamp)
+        s->iformat->read_timestamp = ff_concatgen_read_timestamp;
+    else
+        s->iformat->read_timestamp = NULL;
+    return 0;
+}

Modified: concat/libavformat/playlist.h
==============================================================================
--- concat/libavformat/playlist.h	Wed Aug 26 03:01:06 2009	(r5277)
+++ concat/libavformat/playlist.h	Wed Aug 26 03:08:25 2009	(r5278)
@@ -40,5 +40,11 @@
  */
 int ff_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.
+ */
+int ff_playlist_set_streams(AVFormatContext *s);
+
 #endif /* AVFORMAT_PLAYLIST_H */
 

Modified: concat/libavformat/pls.c
==============================================================================
--- concat/libavformat/pls.c	Wed Aug 26 03:01:06 2009	(r5277)
+++ concat/libavformat/pls.c	Wed Aug 26 03:08:25 2009	(r5278)
@@ -121,7 +121,7 @@ static int pls_read_header(AVFormatConte
     av_free(flist);
     s->priv_data = ctx;
     ff_playlist_populate_context(ctx, ctx->pe_curidx);
-    av_playlist_set_streams(s);
+    ff_playlist_set_streams(s);
     return 0;
 }
 

Modified: concat/libavformat/utils.c.diff
==============================================================================
--- concat/libavformat/utils.c.diff	Wed Aug 26 03:01:06 2009	(r5277)
+++ concat/libavformat/utils.c.diff	Wed Aug 26 03:08:25 2009	(r5278)
@@ -1,5 +1,5 @@
 diff --git a/libavformat/utils.c b/libavformat/utils.c
-index 4cec286..c5d2347 100644
+index 4cec286..ceae77d 100644
 --- a/libavformat/utils.c
 +++ b/libavformat/utils.c
 @@ -27,6 +27,8 @@
@@ -35,7 +35,7 @@ index 4cec286..c5d2347 100644
 +                av_playlist_add_filelist(playlist_ctx, flist, flist_len);
 +                av_strlcpy(ic->filename, filename, sizeof(ic->filename));
 +                ff_playlist_populate_context(playlist_ctx, playlist_ctx->pe_curidx);
-+                av_playlist_set_streams(ic);
++                ff_playlist_set_streams(ic);
 +                *ic_ptr = ic;
 +                return 0;
 +            }

Modified: concat/libavformat/xspf.c
==============================================================================
--- concat/libavformat/xspf.c	Wed Aug 26 03:01:06 2009	(r5277)
+++ concat/libavformat/xspf.c	Wed Aug 26 03:08:25 2009	(r5278)
@@ -144,7 +144,7 @@ static int xspf_read_header(AVFormatCont
     av_free(flist);
     s->priv_data = ctx;
     ff_playlist_populate_context(ctx, ctx->pe_curidx);
-    av_playlist_set_streams(s);
+    ff_playlist_set_streams(s);
     return 0;
 }
 


More information about the FFmpeg-soc mailing list