[FFmpeg-soc] [soc]: r4879 - concat/ffmpeg.c.diff

gkovacs subversion at mplayerhq.hu
Sat Aug 1 03:46:24 CEST 2009


Author: gkovacs
Date: Sat Aug  1 03:46:23 2009
New Revision: 4879

Log:
removed conc parameter and original multi-file interface in favor of comma-separated file list

Modified:
   concat/ffmpeg.c.diff

Modified: concat/ffmpeg.c.diff
==============================================================================
--- concat/ffmpeg.c.diff	Sat Aug  1 03:41:12 2009	(r4878)
+++ concat/ffmpeg.c.diff	Sat Aug  1 03:46:23 2009	(r4879)
@@ -1,5 +1,5 @@
 diff --git a/ffmpeg.c b/ffmpeg.c
-index 22bfed8..fe39b2d 100644
+index 22bfed8..945c9c7 100644
 --- a/ffmpeg.c
 +++ b/ffmpeg.c
 @@ -70,6 +70,8 @@
@@ -11,18 +11,16 @@ index 22bfed8..fe39b2d 100644
  const char program_name[] = "FFmpeg";
  const int program_birth_year = 2000;
  
-@@ -223,6 +225,10 @@ static unsigned int sws_flags = SWS_BICUBIC;
+@@ -223,6 +225,8 @@ static unsigned int sws_flags = SWS_BICUBIC;
  
  static int64_t timer_start;
  
-+static int concatenate_video_files;
-+
 +PlaylistContext *playlist_ctx;
 +
  static uint8_t *audio_buf;
  static uint8_t *audio_out;
  static uint8_t *audio_out2;
-@@ -1237,7 +1243,8 @@ static void print_report(AVFormatContext **output_files,
+@@ -1237,7 +1241,8 @@ static void print_report(AVFormatContext **output_files,
  /* pkt = NULL means EOF (needed to flush decoder buffers) */
  static int output_packet(AVInputStream *ist, int ist_index,
                           AVOutputStream **ost_table, int nb_ostreams,
@@ -32,7 +30,7 @@ index 22bfed8..fe39b2d 100644
  {
      AVFormatContext *os;
      AVOutputStream *ost;
-@@ -1250,7 +1257,24 @@ static int output_packet(AVInputStream *ist, int ist_index,
+@@ -1250,7 +1255,24 @@ static int output_packet(AVInputStream *ist, int ist_index,
      AVSubtitle subtitle, *subtitle_to_free;
      int got_subtitle;
      AVPacket avpkt;
@@ -58,7 +56,7 @@ index 22bfed8..fe39b2d 100644
      if(ist->next_pts == AV_NOPTS_VALUE)
          ist->next_pts= ist->pts;
  
-@@ -1644,6 +1668,7 @@ static int av_encode(AVFormatContext **output_files,
+@@ -1644,6 +1666,7 @@ static int av_encode(AVFormatContext **output_files,
      uint8_t no_packet[MAX_FILES]={0};
      int no_packet_count=0;
  
@@ -66,7 +64,7 @@ index 22bfed8..fe39b2d 100644
      file_table= av_mallocz(nb_input_files * sizeof(AVInputFile));
      if (!file_table)
          goto fail;
-@@ -2278,8 +2303,7 @@ static int av_encode(AVFormatContext **output_files,
+@@ -2278,8 +2301,7 @@ static int av_encode(AVFormatContext **output_files,
          }
  
          //fprintf(stderr,"read #%d.%d size=%d\n", ist->file_index, ist->index, pkt.size);
@@ -76,7 +74,7 @@ index 22bfed8..fe39b2d 100644
              if (verbose >= 0)
                  fprintf(stderr, "Error while decoding stream #%d.%d\n",
                          ist->file_index, ist->index);
-@@ -2300,7 +2324,7 @@ static int av_encode(AVFormatContext **output_files,
+@@ -2300,7 +2322,7 @@ static int av_encode(AVFormatContext **output_files,
      for(i=0;i<nb_istreams;i++) {
          ist = ist_table[i];
          if (ist->decoding_needed) {
@@ -85,7 +83,7 @@ index 22bfed8..fe39b2d 100644
          }
      }
  
-@@ -2848,6 +2872,7 @@ static enum CodecID find_codec_or_die(const char *name, int type, int encoder)
+@@ -2848,10 +2870,12 @@ static enum CodecID find_codec_or_die(const char *name, int type, int encoder)
  
  static void opt_input_file(const char *filename)
  {
@@ -93,33 +91,15 @@ index 22bfed8..fe39b2d 100644
      AVFormatContext *ic;
      AVFormatParameters params, *ap = &params;
      int err, i, ret, rfps, rfps_base;
-@@ -2859,6 +2884,45 @@ static void opt_input_file(const char *filename)
+     int64_t timestamp;
++    char concatenate_video_files;
+ 
+     if (!strcmp(filename, "-"))
+         filename = "pipe:";
+@@ -2859,6 +2883,24 @@ static void opt_input_file(const char *filename)
      using_stdin |= !strncmp(filename, "pipe:", 5) ||
                      !strcmp(filename, "/dev/stdin");
  
-+    if (concatenate_video_files) { // need to specify -conc before -i
-+        if (!playlist_ctx) {
-+            ic = avformat_alloc_context();
-+            av_log(ic, AV_LOG_DEBUG, "Generating playlist ctx\n");
-+            playlist_ctx = av_mallocz(sizeof(*playlist_ctx));
-+            ff_playlist_add_path(playlist_ctx, filename);
-+            ic->nb_streams = 2;
-+            ic->iformat = ff_concat_alloc_demuxer();
-+            ff_playlist_set_context(ic, playlist_ctx);
-+            ff_playlist_populate_context(playlist_ctx, playlist_ctx->pe_curidx);
-+            ff_playlist_set_streams(ic);
-+            nb_input_files = 1;
-+            input_files[0] = ic;
-+            goto configcodecs;
-+        }
-+        else {
-+            av_log(ic, AV_LOG_DEBUG, "Adding file %s to playlist\n", filename);
-+            ff_playlist_add_path(playlist_ctx, filename);
-+            return;
-+        }
-+    }
-+
-+    // alternative interface for concat - specify -i item1,item2,item3
 +    playlist_ctx = ff_playlist_from_encodedstring(filename, ',');
 +    if (playlist_ctx) {
 +        av_log(ic, AV_LOG_DEBUG, "Generating playlist from %s\n", filename);
@@ -135,11 +115,13 @@ index 22bfed8..fe39b2d 100644
 +        input_files[0] = ic;
 +        goto configcodecs;
 +    }
++    else
++        concatenate_video_files = 0;
 +
      /* get default parameters from command line */
      ic = avformat_alloc_context();
  
-@@ -2925,6 +2989,8 @@ static void opt_input_file(const char *filename)
+@@ -2925,6 +2967,8 @@ static void opt_input_file(const char *filename)
          start_time = 0;
      }
  
@@ -148,7 +130,7 @@ index 22bfed8..fe39b2d 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 +3066,8 @@ static void opt_input_file(const char *filename)
+@@ -3000,6 +3044,8 @@ static void opt_input_file(const char *filename)
          dump_format(ic, nb_input_files, filename, 0);
  
      nb_input_files++;
@@ -157,11 +139,3 @@ index 22bfed8..fe39b2d 100644
      file_iformat = NULL;
      file_oformat = NULL;
  
-@@ -3874,6 +3942,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" },
-+    { "conc", OPT_BOOL, {(void*)&concatenate_video_files}, "concatenate video files", "concatenate" },
- 
-     /* video options */
-     { "b", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" },


More information about the FFmpeg-soc mailing list