[FFmpeg-soc] [soc]: r4700 - in concat: ffmpeg.c.diff libavformat/playlist.c libavformat/playlist.h

gkovacs subversion at mplayerhq.hu
Mon Jul 13 07:18:58 CEST 2009


Author: gkovacs
Date: Mon Jul 13 07:18:58 2009
New Revision: 4700

Log:
avoid setting ic->priv in ffmpeg

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

Modified: concat/ffmpeg.c.diff
==============================================================================
--- concat/ffmpeg.c.diff	Mon Jul 13 07:03:52 2009	(r4699)
+++ concat/ffmpeg.c.diff	Mon Jul 13 07:18:58 2009	(r4700)
@@ -1,5 +1,5 @@
 diff --git a/ffmpeg.c b/ffmpeg.c
-index 22bfed8..2526240 100644
+index 22bfed8..235a37b 100644
 --- a/ffmpeg.c
 +++ b/ffmpeg.c
 @@ -70,6 +70,8 @@
@@ -93,7 +93,7 @@ index 22bfed8..2526240 100644
      AVFormatContext *ic;
      AVFormatParameters params, *ap = &params;
      int err, i, ret, rfps, rfps_base;
-@@ -2859,6 +2884,43 @@ static void opt_input_file(const char *filename)
+@@ -2859,6 +2884,42 @@ static void opt_input_file(const char *filename)
      using_stdin |= !strncmp(filename, "pipe:", 5) ||
                      !strcmp(filename, "/dev/stdin");
  
@@ -101,9 +101,8 @@ index 22bfed8..2526240 100644
 +    if (concatenate_video_files) { // need to specify -conc before -i
 +        int filenamelen = strlen(filename);
 +        if (!playlist_ctx) {
-+            ic = av_malloc(sizeof(*ic));
-+//            ic = avformat_alloc_context();
-+            printf("need to generate playlist ctx\n");
++            ic = avformat_alloc_context();
++            av_log(ic, AV_LOG_DEBUG, "Generating playlist ctx\n");
 +            playlist_ctx = ff_playlist_alloc_context();
 +            playlist_ctx->pelist_size = 1;
 +            playlist_ctx->pelist = av_malloc(playlist_ctx->pelist_size * sizeof(*(playlist_ctx->pelist)));
@@ -115,14 +114,14 @@ index 22bfed8..2526240 100644
 +            av_strlcpy(ic->filename, filename, sizeof(ic->filename));
 +            ic->nb_streams = 2;
 +            ic->iformat = ff_concat_alloc_demuxer();
-+            ic->priv_data = playlist_ctx;
++            ff_playlist_set_context(ic, playlist_ctx);
 +            ff_playlist_populate_context(ic);
 +            nb_input_files = 1;
 +            input_files[0] = ic;
 +            goto configcodecs;
 +        }
 +        else {
-+            printf("adding new file to playlist\n");
++            av_log(ic, AV_LOG_DEBUG, "Adding file %s to playlist\n", filename);
 +            ++playlist_ctx->pelist_size;
 +            playlist_ctx->pelist = av_realloc(playlist_ctx->pelist, playlist_ctx->pelist_size * sizeof(*(playlist_ctx->pelist)));
 +            playlist_ctx->pelist[playlist_ctx->pelist_size-1] = av_malloc(sizeof(*(playlist_ctx->pelist[playlist_ctx->pelist_size-1])));
@@ -137,7 +136,7 @@ index 22bfed8..2526240 100644
      /* get default parameters from command line */
      ic = avformat_alloc_context();
  
-@@ -2925,6 +2987,8 @@ static void opt_input_file(const char *filename)
+@@ -2925,6 +2986,8 @@ static void opt_input_file(const char *filename)
          start_time = 0;
      }
  
@@ -146,7 +145,7 @@ index 22bfed8..2526240 100644
      /* update the current parameters so that they match the one of the input stream */
      for(i=0;i<ic->nb_streams;i++) {
          AVCodecContext *enc = ic->streams[i]->codec;
-@@ -3000,6 +3064,8 @@ static void opt_input_file(const char *filename)
+@@ -3000,6 +3063,8 @@ static void opt_input_file(const char *filename)
          dump_format(ic, nb_input_files, filename, 0);
  
      nb_input_files++;
@@ -155,7 +154,7 @@ index 22bfed8..2526240 100644
      file_iformat = NULL;
      file_oformat = NULL;
  
-@@ -3874,6 +3940,7 @@ static const OptionDef options[] = {
+@@ -3874,6 +3939,7 @@ static const OptionDef options[] = {
      { "programid", HAS_ARG | OPT_INT | OPT_EXPERT, {(void*)&opt_programid}, "desired program number", "" },
      { "xerror", OPT_BOOL, {(void*)&exit_on_error}, "exit on error", "error" },
      { "copyinkf", OPT_BOOL | OPT_EXPERT, {(void*)&copy_initial_nonkeyframes}, "copy initial non-keyframes" },

Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c	Mon Jul 13 07:03:52 2009	(r4699)
+++ concat/libavformat/playlist.c	Mon Jul 13 07:18:58 2009	(r4700)
@@ -114,6 +114,12 @@ PlaylistContext *ff_playlist_get_context
         return NULL;
 }
 
+void ff_playlist_set_context(AVFormatContext *ic, PlaylistContext *ctx)
+{
+    if (ic && ctx)
+        ic->priv_data = ctx;
+}
+
 AVStream *ff_playlist_get_stream(PlaylistContext *ctx, int pe_idx, int stream_index)
 {
     if (ctx && pe_idx < ctx->pelist_size && ctx->pelist && ctx->pelist[pe_idx] &&

Modified: concat/libavformat/playlist.h
==============================================================================
--- concat/libavformat/playlist.h	Mon Jul 13 07:03:52 2009	(r4699)
+++ concat/libavformat/playlist.h	Mon Jul 13 07:18:58 2009	(r4700)
@@ -78,6 +78,8 @@ void ff_playlist_populate_context(AVForm
 
 PlaylistContext* ff_playlist_get_context(AVFormatContext *ic);
 
+void ff_playlist_set_context(AVFormatContext *ic, PlaylistContext *ctx);
+
 AVStream *ff_playlist_get_stream(PlaylistContext *ctx, int pe_idx, int stream_index);
 
 AVInputFormat* ff_concat_alloc_demuxer(void);


More information about the FFmpeg-soc mailing list