[FFmpeg-soc] [soc]: r4705 - in concat/libavformat: playlist.c playlist.h

gkovacs subversion at mplayerhq.hu
Mon Jul 13 09:17:55 CEST 2009


Author: gkovacs
Date: Mon Jul 13 09:17:55 2009
New Revision: 4705

Log:
formatting cleanup

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

Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c	Mon Jul 13 09:07:16 2009	(r4704)
+++ concat/libavformat/playlist.c	Mon Jul 13 09:17:55 2009	(r4705)
@@ -33,7 +33,6 @@
 
 void ff_playlist_init_playelem(PlayElem *pe)
 {
-    int i;
     int err;
     pe->ic = av_malloc(sizeof(*(pe->ic)));
     pe->ap = av_malloc(sizeof(*(pe->ap)));
@@ -47,19 +46,15 @@ void ff_playlist_init_playelem(PlayElem 
     if (err < 0)
         av_log(pe->ic, AV_LOG_ERROR, "Error during av_open_input_file\n");
     pe->fmt = pe->ic->iformat;
-    if (!pe->fmt) {
+    if (!pe->fmt)
         av_log(pe->ic, AV_LOG_ERROR, "Input format not set\n");
-    }
     err = av_find_stream_info(pe->ic);
-    if (err < 0) {
+    if (err < 0)
         av_log(pe->ic, AV_LOG_ERROR, "Could not find stream info\n");
-    }
-    if(pe->ic->pb) {
+    if (pe->ic->pb)
         pe->ic->pb->eof_reached = 0;
-    }
-    else {
+    else
         av_log(pe->ic, AV_LOG_ERROR, "ByteIOContext not set\n");
-    }
 }
 
 PlaylistContext* ff_playlist_alloc_context(void)
@@ -83,34 +78,12 @@ void ff_playlist_populate_context(AVForm
     ic = ctx->pelist[ctx->pe_curidx]->ic;
     ic->iformat->read_header(ic, 0);
     s->nb_streams = ic->nb_streams;
-    for (i = 0; i < ic->nb_streams; ++i) {
+    for (i = 0; i < ic->nb_streams; ++i)
         s->streams[i] = ic->streams[i];
-    }
     s->packet_buffer = ic->packet_buffer;
     s->packet_buffer_end = ic->packet_buffer_end;
 }
 
-void ff_playlist_relative_paths(char **flist, const char *workingdir)
-{
-    while (*flist != 0) { // determine if relative paths
-        FILE *file;
-        char *fullfpath;
-        int wdslen = strlen(workingdir);
-        int flslen = strlen(*flist);
-        fullfpath = av_malloc(sizeof(char) * (wdslen+flslen+2));
-        av_strlcpy(fullfpath, workingdir, wdslen+1);
-        fullfpath[wdslen] = '/';
-        fullfpath[wdslen+1] = 0;
-        av_strlcat(fullfpath, *flist, wdslen+flslen+2);
-        file = fopen(fullfpath, "r");
-        if (file) {
-            fclose(file);
-            *flist = fullfpath;
-        }
-        ++flist;
-    }
-}
-
 PlaylistContext *ff_playlist_get_context(AVFormatContext *ic)
 {
     if (ic && ic->iformat && ic->iformat->long_name && ic->priv_data &&
@@ -135,3 +108,23 @@ AVStream *ff_playlist_get_stream(Playlis
     else
         return NULL;
 }
+
+// converts list of mixed absolute and relative paths into all absolute paths
+void ff_playlist_relative_paths(char **flist, const char *workingdir)
+{
+    while (*flist != 0) { // determine if relative paths
+        char *fullfpath;
+        int wdslen = strlen(workingdir);
+        int flslen = strlen(*flist);
+        fullfpath = av_malloc(sizeof(char) * (wdslen+flslen+2));
+        av_strlcpy(fullfpath, workingdir, wdslen+1);
+        fullfpath[wdslen] = '/';
+        fullfpath[wdslen+1] = 0;
+        av_strlcat(fullfpath, *flist, wdslen+flslen+2);
+        if ((FILE *file = fopen(fullfpath, "r"))) {
+            fclose(file);
+            *flist = fullfpath;
+        }
+        ++flist;
+    }
+}

Modified: concat/libavformat/playlist.h
==============================================================================
--- concat/libavformat/playlist.h	Mon Jul 13 09:07:16 2009	(r4704)
+++ concat/libavformat/playlist.h	Mon Jul 13 09:17:55 2009	(r4705)
@@ -97,6 +97,4 @@ void ff_playlist_set_context(AVFormatCon
  */
 AVStream *ff_playlist_get_stream(PlaylistContext *ctx, int pe_idx, int stream_index);
 
-AVInputFormat* ff_concat_alloc_demuxer(void);
-
 #endif /* AVFORMAT_PLAYLIST_H */


More information about the FFmpeg-soc mailing list