[FFmpeg-soc] [soc]: r4241 - in concat: 0001-added-concatenation-option.patch 0002-removed-superfluous-fflush.patch 0003-removed-color-table-check.patch 0004-added-extradata-handling.patch 0005-more-code-cleanup...

gkovacs subversion at mplayerhq.hu
Mon Apr 27 11:03:24 CEST 2009


Author: gkovacs
Date: Mon Apr 27 11:03:23 2009
New Revision: 4241

Log:
initial commit

Added:
   concat/0001-added-concatenation-option.patch
   concat/0002-removed-superfluous-fflush.patch
   concat/0003-removed-color-table-check.patch
   concat/0004-added-extradata-handling.patch
   concat/0005-more-code-cleanup.patch
   concat/0006-code-formatting-fixes.patch
   concat/0007-attempting-same-format-concatenation-to-single-strea.patch

Added: concat/0001-added-concatenation-option.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ concat/0001-added-concatenation-option.patch	Mon Apr 27 11:03:23 2009	(r4241)
@@ -0,0 +1,249 @@
+From 876dbb04b0d56173568c15a1bb9bed4b119b8b56 Mon Sep 17 00:00:00 2001
+From: Geza Kovacs <gkovacs at mit.edu>
+Date: Thu, 2 Apr 2009 04:27:52 -0400
+Subject: [PATCH] added concatenation option
+
+---
+ ffmpeg.c |  205 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 files changed, 205 insertions(+), 0 deletions(-)
+
+diff --git a/ffmpeg.c b/ffmpeg.c
+index cb15120..7dd7ae6 100644
+--- a/ffmpeg.c
++++ b/ffmpeg.c
+@@ -193,6 +193,7 @@ static char *vstats_filename;
+ static FILE *vstats_file;
+ static int opt_programid = 0;
+ static int copy_initial_nonkeyframes = 0;
++static int concatenate_video_files = 0;
+ 
+ static int rate_emu = 0;
+ 
+@@ -1537,6 +1538,192 @@ static int stream_index_from_inputs(AVFormatContext **input_files,
+     return -1;
+ }
+ 
++/**
++ * check_same_settings checks that the input formats are identical, used internally by concatenation
++ * @param AVFormatContext **input_format_contexts list of input format contexts
++ * @param int num_input_files number of input files.
++ * @return returns 0 on success or -1 on failure
++ */
++static int check_same_settings(AVFormatContext **input_format_contexts, int num_input_files)
++{
++    int color_table_id;
++    char color_table_id_set = 0;
++    int width;
++    char width_set = 0;
++    int height;
++    char height_set = 0;
++    int frame_rate_num;
++    int frame_rate_den;
++    char frame_rate_set = 0;
++    int i;
++    int j;
++    for (i = 0; i < num_input_files; ++i) {
++        for (j = 0; j < input_format_contexts[i]->nb_streams; ++j) {
++            if (avcodec_open(input_format_contexts[i]->streams[j]->codec, avcodec_find_decoder(input_format_contexts[i]->streams[j]->codec->codec_id)) < 0) {
++                fprintf(stderr, "Error: could not open codec for input file %s\n", input_format_contexts[i]->filename);
++                return -1;
++            }
++            if (!color_table_id_set) {
++                color_table_id_set = 1;
++                color_table_id = input_format_contexts[i]->streams[j]->codec->color_table_id;
++            }
++            else if (input_format_contexts[i]->streams[j]->codec->color_table_id != color_table_id) {
++                fprintf(stderr, "Error: different color table for input file %s: %i vs existing %i \n", input_format_contexts[i]->filename, input_format_contexts[i]->streams[j]->codec->color_table_id, color_table_id);
++                fflush(stderr);
++                return -1;
++            }
++            if (!frame_rate_set) {
++                frame_rate_set = 1;
++                frame_rate_num = input_format_contexts[i]->streams[j]->r_frame_rate.num;
++                frame_rate_den = input_format_contexts[i]->streams[j]->r_frame_rate.den;
++            }
++            else if (input_format_contexts[i]->streams[j]->r_frame_rate.num != frame_rate_num || input_format_contexts[i]->streams[j]->r_frame_rate.den != frame_rate_den) {
++                fprintf(stderr, "Error: different frame rate for input file %s: %i/%i vs existing %i/%i\n", input_format_contexts[i]->filename, input_format_contexts[i]->streams[j]->r_frame_rate.num, input_format_contexts[i]->streams[j]->r_frame_rate.den, frame_rate_num, frame_rate_den);
++                fflush(stderr);
++                return -1;
++            }
++            if (!width_set) {
++                width_set = 1;
++                width = input_format_contexts[i]->streams[j]->codec->width;
++            }
++            else if (input_format_contexts[i]->streams[j]->codec->width != width) {
++                fprintf(stderr, "Error: different width for input file %s: %i vs existing %i\n", input_format_contexts[i]->filename, input_format_contexts[i]->streams[j]->codec->width, width);
++                fflush(stderr);
++                return -1;
++            }
++            if (!height_set) {
++                height_set = 1;
++                height = input_format_contexts[i]->streams[j]->codec->height;
++            }
++            else if (input_format_contexts[i]->streams[j]->codec->height != height) {
++                fprintf(stderr, "Error: different height for input file %s: %i vs existing %i\n", input_format_contexts[i]->filename, input_format_contexts[i]->streams[j]->codec->width, width);
++                fflush(stderr);
++                return -1;
++            }
++        }
++    }
++    return 0;
++}
++
++/**
++ * get_audio_codec retrives the CodecID of the audio stream
++ * @param AVFormatContext *input_format_context input format context
++ * @return returns audio CodecID on success or 0 on failure
++ */
++static int get_audio_codec(AVFormatContext *input_format_context)
++{
++    int i;
++    for (i = 0; i < input_format_context->nb_streams; ++i) {
++        if (input_format_context->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO) {
++            return input_format_context->streams[i]->codec->codec_id;
++        }
++    }
++    return 0;
++}
++
++/**
++ * get_video_codec retrives the CodecID of the video stream
++ * @param AVFormatContext *input_format_context input format context
++ * @return returns video CodecID on success or 0 on failure
++ */
++static int get_video_codec(AVFormatContext *input_format_context)
++{
++    int i;
++    for (i = 0; i < input_format_context->nb_streams; ++i) {
++        if (input_format_context->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO) {
++            return input_format_context->streams[i]->codec->codec_id;
++        }
++    }
++    return 0;
++}
++
++/**
++ * setup_output_file populates the AVFormatContext for the output file with appropriate values from input_format_context, used internally by concatenation
++ * @param AVFormatContext *output_format_context format context for output file
++ * @param AVFormatContext *input_format_context format context for input file, assumed to be of same format as desired output
++ * @return returns 0 on success
++ */
++static int setup_output_file(AVFormatContext *output_format_context, AVFormatContext *input_format_context)
++{
++    output_format_context->oformat->video_codec = get_video_codec(input_format_context);
++    output_format_context->oformat->audio_codec = get_audio_codec(output_format_context);
++    output_format_context->timestamp = input_format_context->timestamp;
++    output_format_context->start_time = input_format_context->start_time;
++    output_format_context->bit_rate = input_format_context->bit_rate;
++    int i;
++    for (i = 0; i < input_format_context->nb_streams; ++i) {
++        if (i >= output_format_context->nb_streams) {
++            output_format_context->streams[i] = av_new_stream(output_format_context, input_format_context->streams[i]->id);
++        }
++        if (!output_format_context->streams[i]) {
++            fprintf(stderr, "Error: Could not allocate stream %i in file %s\n", i, output_format_context->filename);
++            fflush(stderr);
++            return -1;
++        }
++        output_format_context->streams[i]->id = input_format_context->streams[i]->id;
++        output_format_context->streams[i]->sample_aspect_ratio = input_format_context->streams[i]->sample_aspect_ratio;
++        AVCodec *codec = avcodec_find_encoder(input_format_context->streams[i]->codec->codec_id);
++        output_format_context->streams[i]->codec = avcodec_alloc_context();
++        output_format_context->streams[i]->codec->sample_aspect_ratio = output_format_context->streams[i]->sample_aspect_ratio;
++        output_format_context->streams[i]->codec->codec_type = input_format_context->streams[i]->codec->codec_type;
++        if (input_format_context->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO) {
++            if(output_format_context->oformat->flags & AVFMT_GLOBALHEADER)
++                output_format_context->streams[i]->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
++            output_format_context->streams[i]->codec->pix_fmt = input_format_context->streams[i]->codec->pix_fmt;
++            output_format_context->streams[i]->codec->time_base = input_format_context->streams[i]->codec->time_base;
++            output_format_context->streams[i]->codec->width = input_format_context->streams[i]->codec->width;
++            output_format_context->streams[i]->codec->height = input_format_context->streams[i]->codec->height;
++        }
++        else if (input_format_context->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO) {
++            output_format_context->streams[i]->codec->sample_rate = input_format_context->streams[i]->codec->sample_rate;
++        }
++        if (avcodec_open(output_format_context->streams[i]->codec, codec) < 0) {
++            fprintf(stderr, "Error: Could not open codec for stream %i in file %s\n", i, output_format_context->filename);
++            fflush(stderr);
++            return -1;
++        }
++    }
++    if (av_write_header(output_format_context) != 0) {
++        fprintf(stderr, "Error: could not write header for %s\n", output_format_context->filename);
++        fflush(stderr);
++        return -1;
++    }
++    return 0;
++}
++
++/**
++ * write_frames_to_output reads frames from the input format contexts and writes them to the output format context
++ * @param AVFormatContext **input_format_contexts list of input format contexts
++ * @param int num_input_files number of input files
++ * @param AVFormatContext *output_format_context format context for the output file
++ * @return returns 0 on success
++ */
++static int write_frames_to_output(AVFormatContext **input_format_contexts, int num_input_files, AVFormatContext *output_format_context)
++{
++    AVPacket *packet = av_malloc(sizeof(AVPacket));
++    int64_t packet_pts;
++    int64_t packet_timestamp_offset = 0;
++    int i;
++    for (i = 0; i < num_input_files; ++i) {
++        av_get_packet(input_format_contexts[i]->pb, packet, 4096);
++        av_read_frame(input_format_contexts[i], packet);
++        while (av_read_frame(input_format_contexts[i], packet) == 0) {
++            packet->pts += packet_timestamp_offset;
++            packet->dts += packet_timestamp_offset;
++            packet_pts = packet->pts;
++            if (av_write_frame(output_format_context, packet) != 0) {
++                fprintf(stderr, "Error writing frame to %s from input file %s\n", output_format_context->filename, input_format_contexts[i]->filename);
++                fflush(stderr);
++                return -1;
++            }
++            av_free_packet(packet);
++        
++        }
++        packet_timestamp_offset += packet_pts;
++    }
++    return 0;
++}
++
+ /*
+  * The following code is the main loop of the file converter
+  */
+@@ -1546,6 +1733,23 @@ static int av_encode(AVFormatContext **output_files,
+                      int nb_input_files,
+                      AVStreamMap *stream_maps, int nb_stream_maps)
+ {
++    if (concatenate_video_files) {
++        printf("concatenating video files\n");
++        if (check_same_settings(input_files, nb_input_files) != 0) {
++            av_exit(1);
++        }
++        printf("file formats are the same\n");
++        if (setup_output_file(output_files[0], input_files[0]) != 0) {
++            av_exit(1);
++        }
++        printf("set up output file\n");
++        if (write_frames_to_output(input_files, nb_input_files, output_files[0] != 0) {
++            av_exit(1);
++        }
++        av_write_trailer(output_files[0]);
++        printf("wrote frames to output\n");
++        return 0;
++    }
+     int ret = 0, i, j, k, n, nb_istreams = 0, nb_ostreams = 0;
+     AVFormatContext *is, *os;
+     AVCodecContext *codec, *icodec;
+@@ -3826,6 +4030,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" },
+-- 
+1.6.0.4
+

Added: concat/0002-removed-superfluous-fflush.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ concat/0002-removed-superfluous-fflush.patch	Mon Apr 27 11:03:23 2009	(r4241)
@@ -0,0 +1,78 @@
+From 047200b97ff83e0e86a7c2564c900d624ffef16c Mon Sep 17 00:00:00 2001
+From: Geza Kovacs <gkovacs at mit.edu>
+Date: Thu, 2 Apr 2009 04:36:11 -0400
+Subject: [PATCH] removed superfluous fflush
+
+---
+ ffmpeg.c |    8 --------
+ 1 files changed, 0 insertions(+), 8 deletions(-)
+
+diff --git a/ffmpeg.c b/ffmpeg.c
+index 7dd7ae6..cda0d50 100644
+--- a/ffmpeg.c
++++ b/ffmpeg.c
+@@ -1569,7 +1569,6 @@ static int check_same_settings(AVFormatContext **input_format_contexts, int num_
+             }
+             else if (input_format_contexts[i]->streams[j]->codec->color_table_id != color_table_id) {
+                 fprintf(stderr, "Error: different color table for input file %s: %i vs existing %i \n", input_format_contexts[i]->filename, input_format_contexts[i]->streams[j]->codec->color_table_id, color_table_id);
+-                fflush(stderr);
+                 return -1;
+             }
+             if (!frame_rate_set) {
+@@ -1579,7 +1578,6 @@ static int check_same_settings(AVFormatContext **input_format_contexts, int num_
+             }
+             else if (input_format_contexts[i]->streams[j]->r_frame_rate.num != frame_rate_num || input_format_contexts[i]->streams[j]->r_frame_rate.den != frame_rate_den) {
+                 fprintf(stderr, "Error: different frame rate for input file %s: %i/%i vs existing %i/%i\n", input_format_contexts[i]->filename, input_format_contexts[i]->streams[j]->r_frame_rate.num, input_format_contexts[i]->streams[j]->r_frame_rate.den, frame_rate_num, frame_rate_den);
+-                fflush(stderr);
+                 return -1;
+             }
+             if (!width_set) {
+@@ -1588,7 +1586,6 @@ static int check_same_settings(AVFormatContext **input_format_contexts, int num_
+             }
+             else if (input_format_contexts[i]->streams[j]->codec->width != width) {
+                 fprintf(stderr, "Error: different width for input file %s: %i vs existing %i\n", input_format_contexts[i]->filename, input_format_contexts[i]->streams[j]->codec->width, width);
+-                fflush(stderr);
+                 return -1;
+             }
+             if (!height_set) {
+@@ -1597,7 +1594,6 @@ static int check_same_settings(AVFormatContext **input_format_contexts, int num_
+             }
+             else if (input_format_contexts[i]->streams[j]->codec->height != height) {
+                 fprintf(stderr, "Error: different height for input file %s: %i vs existing %i\n", input_format_contexts[i]->filename, input_format_contexts[i]->streams[j]->codec->width, width);
+-                fflush(stderr);
+                 return -1;
+             }
+         }
+@@ -1657,7 +1653,6 @@ static int setup_output_file(AVFormatContext *output_format_context, AVFormatCon
+         }
+         if (!output_format_context->streams[i]) {
+             fprintf(stderr, "Error: Could not allocate stream %i in file %s\n", i, output_format_context->filename);
+-            fflush(stderr);
+             return -1;
+         }
+         output_format_context->streams[i]->id = input_format_context->streams[i]->id;
+@@ -1679,13 +1674,11 @@ static int setup_output_file(AVFormatContext *output_format_context, AVFormatCon
+         }
+         if (avcodec_open(output_format_context->streams[i]->codec, codec) < 0) {
+             fprintf(stderr, "Error: Could not open codec for stream %i in file %s\n", i, output_format_context->filename);
+-            fflush(stderr);
+             return -1;
+         }
+     }
+     if (av_write_header(output_format_context) != 0) {
+         fprintf(stderr, "Error: could not write header for %s\n", output_format_context->filename);
+-        fflush(stderr);
+         return -1;
+     }
+     return 0;
+@@ -1713,7 +1706,6 @@ static int write_frames_to_output(AVFormatContext **input_format_contexts, int n
+             packet_pts = packet->pts;
+             if (av_write_frame(output_format_context, packet) != 0) {
+                 fprintf(stderr, "Error writing frame to %s from input file %s\n", output_format_context->filename, input_format_contexts[i]->filename);
+-                fflush(stderr);
+                 return -1;
+             }
+             av_free_packet(packet);
+-- 
+1.6.0.4
+

Added: concat/0003-removed-color-table-check.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ concat/0003-removed-color-table-check.patch	Mon Apr 27 11:03:23 2009	(r4241)
@@ -0,0 +1,40 @@
+From a507defd145d6a0c0c4ff96770795461db6c0b7b Mon Sep 17 00:00:00 2001
+From: Geza Kovacs <gkovacs at mit.edu>
+Date: Thu, 2 Apr 2009 04:41:17 -0400
+Subject: [PATCH] removed color table check
+
+---
+ ffmpeg.c |   10 ----------
+ 1 files changed, 0 insertions(+), 10 deletions(-)
+
+diff --git a/ffmpeg.c b/ffmpeg.c
+index cda0d50..6beb890 100644
+--- a/ffmpeg.c
++++ b/ffmpeg.c
+@@ -1546,8 +1546,6 @@ static int stream_index_from_inputs(AVFormatContext **input_files,
+  */
+ static int check_same_settings(AVFormatContext **input_format_contexts, int num_input_files)
+ {
+-    int color_table_id;
+-    char color_table_id_set = 0;
+     int width;
+     char width_set = 0;
+     int height;
+@@ -1563,14 +1561,6 @@ static int check_same_settings(AVFormatContext **input_format_contexts, int num_
+                 fprintf(stderr, "Error: could not open codec for input file %s\n", input_format_contexts[i]->filename);
+                 return -1;
+             }
+-            if (!color_table_id_set) {
+-                color_table_id_set = 1;
+-                color_table_id = input_format_contexts[i]->streams[j]->codec->color_table_id;
+-            }
+-            else if (input_format_contexts[i]->streams[j]->codec->color_table_id != color_table_id) {
+-                fprintf(stderr, "Error: different color table for input file %s: %i vs existing %i \n", input_format_contexts[i]->filename, input_format_contexts[i]->streams[j]->codec->color_table_id, color_table_id);
+-                return -1;
+-            }
+             if (!frame_rate_set) {
+                 frame_rate_set = 1;
+                 frame_rate_num = input_format_contexts[i]->streams[j]->r_frame_rate.num;
+-- 
+1.6.0.4
+

Added: concat/0004-added-extradata-handling.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ concat/0004-added-extradata-handling.patch	Mon Apr 27 11:03:23 2009	(r4241)
@@ -0,0 +1,25 @@
+From b3c1851cd831d1a6ca61525d90d58fbfdf72fece Mon Sep 17 00:00:00 2001
+From: Geza Kovacs <gkovacs at mit.edu>
+Date: Thu, 2 Apr 2009 04:44:50 -0400
+Subject: [PATCH] added extradata handling
+
+---
+ ffmpeg.c |    2 ++
+ 1 files changed, 2 insertions(+), 0 deletions(-)
+
+diff --git a/ffmpeg.c b/ffmpeg.c
+index 6beb890..5359182 100644
+--- a/ffmpeg.c
++++ b/ffmpeg.c
+@@ -1650,6 +1650,8 @@ static int setup_output_file(AVFormatContext *output_format_context, AVFormatCon
+         AVCodec *codec = avcodec_find_encoder(input_format_context->streams[i]->codec->codec_id);
+         output_format_context->streams[i]->codec = avcodec_alloc_context();
+         output_format_context->streams[i]->codec->sample_aspect_ratio = output_format_context->streams[i]->sample_aspect_ratio;
++        output_format_context->streams[i]->codec->extradata = input_format_context->streams[i]->codec->extradata;
++        output_format_context->streams[i]->codec->extradata_size = input_format_context->streams[i]->codec->extradata_size;
+         output_format_context->streams[i]->codec->codec_type = input_format_context->streams[i]->codec->codec_type;
+         if (input_format_context->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO) {
+             if(output_format_context->oformat->flags & AVFMT_GLOBALHEADER)
+-- 
+1.6.0.4
+

Added: concat/0005-more-code-cleanup.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ concat/0005-more-code-cleanup.patch	Mon Apr 27 11:03:23 2009	(r4241)
@@ -0,0 +1,153 @@
+From 1e5b5cb33f148f763067e17ae6c50ae7da032ee2 Mon Sep 17 00:00:00 2001
+From: Geza Kovacs <gkovacs at mit.edu>
+Date: Thu, 2 Apr 2009 06:05:03 -0400
+Subject: [PATCH] more code cleanup
+
+---
+ ffmpeg.c |   48 ++++++++++++++++++++++++------------------------
+ 1 files changed, 24 insertions(+), 24 deletions(-)
+
+diff --git a/ffmpeg.c b/ffmpeg.c
+index 5359182..6abf8b0 100644
+--- a/ffmpeg.c
++++ b/ffmpeg.c
+@@ -1539,25 +1539,21 @@ static int stream_index_from_inputs(AVFormatContext **input_files,
+ }
+ 
+ /**
+- * check_same_settings checks that the input formats are identical, used internally by concatenation
++ * Function check_same_settings checks that the input formats are identical. It is used internally by concatenation.
+  * @param AVFormatContext **input_format_contexts list of input format contexts
+  * @param int num_input_files number of input files.
+  * @return returns 0 on success or -1 on failure
+  */
+ static int check_same_settings(AVFormatContext **input_format_contexts, int num_input_files)
+ {
+-    int width;
++    int width, height, frame_rate_num, frame_rate_den, i, j;
+     char width_set = 0;
+-    int height;
+     char height_set = 0;
+-    int frame_rate_num;
+-    int frame_rate_den;
+     char frame_rate_set = 0;
+-    int i;
+-    int j;
+     for (i = 0; i < num_input_files; ++i) {
+         for (j = 0; j < input_format_contexts[i]->nb_streams; ++j) {
+-            if (avcodec_open(input_format_contexts[i]->streams[j]->codec, avcodec_find_decoder(input_format_contexts[i]->streams[j]->codec->codec_id)) < 0) {
++            if (avcodec_open(input_format_contexts[i]->streams[j]->codec,
++                avcodec_find_decoder(input_format_contexts[i]->streams[j]->codec->codec_id)) < 0) {
+                 fprintf(stderr, "Error: could not open codec for input file %s\n", input_format_contexts[i]->filename);
+                 return -1;
+             }
+@@ -1592,7 +1588,7 @@ static int check_same_settings(AVFormatContext **input_format_contexts, int num_
+ }
+ 
+ /**
+- * get_audio_codec retrives the CodecID of the audio stream
++ * Function get_audio_codec retrives the CodecID of the audio stream. It is used internally by concatenation.
+  * @param AVFormatContext *input_format_context input format context
+  * @return returns audio CodecID on success or 0 on failure
+  */
+@@ -1600,15 +1596,14 @@ static int get_audio_codec(AVFormatContext *input_format_context)
+ {
+     int i;
+     for (i = 0; i < input_format_context->nb_streams; ++i) {
+-        if (input_format_context->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO) {
++        if (input_format_context->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO)
+             return input_format_context->streams[i]->codec->codec_id;
+-        }
+     }
+     return 0;
+ }
+ 
+ /**
+- * get_video_codec retrives the CodecID of the video stream
++ * Function get_video_codec retrives the CodecID of the video stream. It is used internally by concatenation.
+  * @param AVFormatContext *input_format_context input format context
+  * @return returns video CodecID on success or 0 on failure
+  */
+@@ -1616,38 +1611,42 @@ static int get_video_codec(AVFormatContext *input_format_context)
+ {
+     int i;
+     for (i = 0; i < input_format_context->nb_streams; ++i) {
+-        if (input_format_context->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO) {
++        if (input_format_context->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO)
+             return input_format_context->streams[i]->codec->codec_id;
+-        }
+     }
+     return 0;
+ }
+ 
+ /**
+- * setup_output_file populates the AVFormatContext for the output file with appropriate values from input_format_context, used internally by concatenation
++ * Function setup_output_file populates the AVFormatContext for the output file
++ * with appropriate values from input_format_context. It is used internally by
++ * concatenation.
+  * @param AVFormatContext *output_format_context format context for output file
+- * @param AVFormatContext *input_format_context format context for input file, assumed to be of same format as desired output
++ * @param AVFormatContext *input_format_context format context for input file,
++ * assumed to be of same format as desired output
+  * @return returns 0 on success
+  */
+-static int setup_output_file(AVFormatContext *output_format_context, AVFormatContext *input_format_context)
++static int setup_output_file(AVFormatContext *output_format_context,
++    AVFormatContext *input_format_context)
+ {
++    int i;
+     output_format_context->oformat->video_codec = get_video_codec(input_format_context);
+     output_format_context->oformat->audio_codec = get_audio_codec(output_format_context);
+     output_format_context->timestamp = input_format_context->timestamp;
+     output_format_context->start_time = input_format_context->start_time;
+     output_format_context->bit_rate = input_format_context->bit_rate;
+-    int i;
+     for (i = 0; i < input_format_context->nb_streams; ++i) {
+         if (i >= output_format_context->nb_streams) {
+-            output_format_context->streams[i] = av_new_stream(output_format_context, input_format_context->streams[i]->id);
++            output_format_context->streams[i] = av_new_stream(output_format_context,
++                input_format_context->streams[i]->id);
+         }
+         if (!output_format_context->streams[i]) {
+-            fprintf(stderr, "Error: Could not allocate stream %i in file %s\n", i, output_format_context->filename);
++            fprintf(stderr, "Error: Could not allocate stream %i in file %s\n",
++                i, output_format_context->filename);
+             return -1;
+         }
+         output_format_context->streams[i]->id = input_format_context->streams[i]->id;
+         output_format_context->streams[i]->sample_aspect_ratio = input_format_context->streams[i]->sample_aspect_ratio;
+-        AVCodec *codec = avcodec_find_encoder(input_format_context->streams[i]->codec->codec_id);
+         output_format_context->streams[i]->codec = avcodec_alloc_context();
+         output_format_context->streams[i]->codec->sample_aspect_ratio = output_format_context->streams[i]->sample_aspect_ratio;
+         output_format_context->streams[i]->codec->extradata = input_format_context->streams[i]->codec->extradata;
+@@ -1664,7 +1663,7 @@ static int setup_output_file(AVFormatContext *output_format_context, AVFormatCon
+         else if (input_format_context->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO) {
+             output_format_context->streams[i]->codec->sample_rate = input_format_context->streams[i]->codec->sample_rate;
+         }
+-        if (avcodec_open(output_format_context->streams[i]->codec, codec) < 0) {
++        if (avcodec_open(output_format_context->streams[i]->codec, avcodec_find_encoder(input_format_context->streams[i]->codec->codec_id)) < 0) {
+             fprintf(stderr, "Error: Could not open codec for stream %i in file %s\n", i, output_format_context->filename);
+             return -1;
+         }
+@@ -1677,7 +1676,8 @@ static int setup_output_file(AVFormatContext *output_format_context, AVFormatCon
+ }
+ 
+ /**
+- * write_frames_to_output reads frames from the input format contexts and writes them to the output format context
++ * write_frames_to_output reads frames from the input format contexts
++ * and writes them to the output format context
+  * @param AVFormatContext **input_format_contexts list of input format contexts
+  * @param int num_input_files number of input files
+  * @param AVFormatContext *output_format_context format context for the output file
+@@ -1727,7 +1727,7 @@ static int av_encode(AVFormatContext **output_files,
+             av_exit(1);
+         }
+         printf("set up output file\n");
+-        if (write_frames_to_output(input_files, nb_input_files, output_files[0] != 0) {
++        if (write_frames_to_output(input_files, nb_input_files, output_files[0]) != 0) {
+             av_exit(1);
+         }
+         av_write_trailer(output_files[0]);
+-- 
+1.6.0.4
+

Added: concat/0006-code-formatting-fixes.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ concat/0006-code-formatting-fixes.patch	Mon Apr 27 11:03:23 2009	(r4241)
@@ -0,0 +1,241 @@
+From d56880e758f2545f117c0dc3e0cf02e7f129445c Mon Sep 17 00:00:00 2001
+From: Geza Kovacs <gkovacs at mit.edu>
+Date: Sat, 25 Apr 2009 10:56:16 -0400
+Subject: [PATCH] code formatting fixes
+
+---
+ ffmpeg.c |  134 +++++++++++++++++++++++++++++++++++++++-----------------------
+ 1 files changed, 84 insertions(+), 50 deletions(-)
+
+diff --git a/ffmpeg.c b/ffmpeg.c
+index 6abf8b0..248e38f 100644
+--- a/ffmpeg.c
++++ b/ffmpeg.c
+@@ -1539,12 +1539,14 @@ static int stream_index_from_inputs(AVFormatContext **input_files,
+ }
+ 
+ /**
+- * Function check_same_settings checks that the input formats are identical. It is used internally by concatenation.
+- * @param AVFormatContext **input_format_contexts list of input format contexts
+- * @param int num_input_files number of input files.
+- * @return returns 0 on success or -1 on failure
++ * Function check_same_settings checks that the input formats are identical.
++ * It is used internally by concatenation.
++ * @param AVFormatContext **input_format_contexts List of input format contexts.
++ * @param int num_input_files Number of input files.
++ * @return Returns 0 on success or -1 on failure.
+  */
+-static int check_same_settings(AVFormatContext **input_format_contexts, int num_input_files)
++static int check_same_settings(AVFormatContext **input_format_contexts,
++                               int num_input_files)
+ {
+     int width, height, frame_rate_num, frame_rate_den, i, j;
+     char width_set = 0;
+@@ -1554,7 +1556,8 @@ static int check_same_settings(AVFormatContext **input_format_contexts, int num_
+         for (j = 0; j < input_format_contexts[i]->nb_streams; ++j) {
+             if (avcodec_open(input_format_contexts[i]->streams[j]->codec,
+                 avcodec_find_decoder(input_format_contexts[i]->streams[j]->codec->codec_id)) < 0) {
+-                fprintf(stderr, "Error: could not open codec for input file %s\n", input_format_contexts[i]->filename);
++                fprintf(stderr, "Error: could not open codec for input file %s\n",
++                        input_format_contexts[i]->filename);
+                 return -1;
+             }
+             if (!frame_rate_set) {
+@@ -1562,8 +1565,14 @@ static int check_same_settings(AVFormatContext **input_format_contexts, int num_
+                 frame_rate_num = input_format_contexts[i]->streams[j]->r_frame_rate.num;
+                 frame_rate_den = input_format_contexts[i]->streams[j]->r_frame_rate.den;
+             }
+-            else if (input_format_contexts[i]->streams[j]->r_frame_rate.num != frame_rate_num || input_format_contexts[i]->streams[j]->r_frame_rate.den != frame_rate_den) {
+-                fprintf(stderr, "Error: different frame rate for input file %s: %i/%i vs existing %i/%i\n", input_format_contexts[i]->filename, input_format_contexts[i]->streams[j]->r_frame_rate.num, input_format_contexts[i]->streams[j]->r_frame_rate.den, frame_rate_num, frame_rate_den);
++            else if (input_format_contexts[i]->streams[j]->r_frame_rate.num != frame_rate_num
++                || input_format_contexts[i]->streams[j]->r_frame_rate.den != frame_rate_den) {
++                fprintf(stderr, "Error: different frame rate for input file %s: %i/%i vs existing %i/%i\n",
++                        input_format_contexts[i]->filename,
++                        input_format_contexts[i]->streams[j]->r_frame_rate.num,
++                        input_format_contexts[i]->streams[j]->r_frame_rate.den,
++                        frame_rate_num,
++                        frame_rate_den);
+                 return -1;
+             }
+             if (!width_set) {
+@@ -1571,7 +1580,10 @@ static int check_same_settings(AVFormatContext **input_format_contexts, int num_
+                 width = input_format_contexts[i]->streams[j]->codec->width;
+             }
+             else if (input_format_contexts[i]->streams[j]->codec->width != width) {
+-                fprintf(stderr, "Error: different width for input file %s: %i vs existing %i\n", input_format_contexts[i]->filename, input_format_contexts[i]->streams[j]->codec->width, width);
++                fprintf(stderr, "Error: different width for input file %s: %i vs existing %i\n",
++                        input_format_contexts[i]->filename,
++                        input_format_contexts[i]->streams[j]->codec->width,
++                        width);
+                 return -1;
+             }
+             if (!height_set) {
+@@ -1579,7 +1591,10 @@ static int check_same_settings(AVFormatContext **input_format_contexts, int num_
+                 height = input_format_contexts[i]->streams[j]->codec->height;
+             }
+             else if (input_format_contexts[i]->streams[j]->codec->height != height) {
+-                fprintf(stderr, "Error: different height for input file %s: %i vs existing %i\n", input_format_contexts[i]->filename, input_format_contexts[i]->streams[j]->codec->width, width);
++                fprintf(stderr, "Error: different height for input file %s: %i vs existing %i\n",
++                        input_format_contexts[i]->filename,
++                        input_format_contexts[i]->streams[j]->codec->width,
++                        width);
+                 return -1;
+             }
+         }
+@@ -1588,9 +1603,10 @@ static int check_same_settings(AVFormatContext **input_format_contexts, int num_
+ }
+ 
+ /**
+- * Function get_audio_codec retrives the CodecID of the audio stream. It is used internally by concatenation.
+- * @param AVFormatContext *input_format_context input format context
+- * @return returns audio CodecID on success or 0 on failure
++ * Retrives the CodecID of the audio stream.
++ * This is used internally by concatenation.
++ * @param AVFormatContext *input_format_context Input format context.
++ * @return Returns audio CodecID on success or -1 on failure.
+  */
+ static int get_audio_codec(AVFormatContext *input_format_context)
+ {
+@@ -1599,13 +1615,14 @@ static int get_audio_codec(AVFormatContext *input_format_context)
+         if (input_format_context->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO)
+             return input_format_context->streams[i]->codec->codec_id;
+     }
+-    return 0;
++    return -1;
+ }
+ 
+ /**
+- * Function get_video_codec retrives the CodecID of the video stream. It is used internally by concatenation.
+- * @param AVFormatContext *input_format_context input format context
+- * @return returns video CodecID on success or 0 on failure
++ * Retrives the CodecID of the video stream.
++ * This is used internally by concatenation.
++ * @param AVFormatContext *input_format_context Input format context.
++ * @return Returns video CodecID on success or -1 on failure.
+  */
+ static int get_video_codec(AVFormatContext *input_format_context)
+ {
+@@ -1614,20 +1631,20 @@ static int get_video_codec(AVFormatContext *input_format_context)
+         if (input_format_context->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO)
+             return input_format_context->streams[i]->codec->codec_id;
+     }
+-    return 0;
++    return -1;
+ }
+ 
+ /**
+- * Function setup_output_file populates the AVFormatContext for the output file
+- * with appropriate values from input_format_context. It is used internally by
+- * concatenation.
+- * @param AVFormatContext *output_format_context format context for output file
+- * @param AVFormatContext *input_format_context format context for input file,
+- * assumed to be of same format as desired output
+- * @return returns 0 on success
++ * Populates the AVFormatContext for the output file
++ * with appropriate values from input_format_context.
++ * This is used internally by concatenation.
++ * @param AVFormatContext *output_format_context Format context for output file.
++ * @param AVFormatContext *input_format_context Format context for input file,
++ * assumed to be of same format as desired output.
++ * @return Returns 0 on success.
+  */
+ static int setup_output_file(AVFormatContext *output_format_context,
+-    AVFormatContext *input_format_context)
++                             AVFormatContext *input_format_context)
+ {
+     int i;
+     output_format_context->oformat->video_codec = get_video_codec(input_format_context);
+@@ -1645,26 +1662,39 @@ static int setup_output_file(AVFormatContext *output_format_context,
+                 i, output_format_context->filename);
+             return -1;
+         }
+-        output_format_context->streams[i]->id = input_format_context->streams[i]->id;
+-        output_format_context->streams[i]->sample_aspect_ratio = input_format_context->streams[i]->sample_aspect_ratio;
+-        output_format_context->streams[i]->codec = avcodec_alloc_context();
+-        output_format_context->streams[i]->codec->sample_aspect_ratio = output_format_context->streams[i]->sample_aspect_ratio;
+-        output_format_context->streams[i]->codec->extradata = input_format_context->streams[i]->codec->extradata;
+-        output_format_context->streams[i]->codec->extradata_size = input_format_context->streams[i]->codec->extradata_size;
+-        output_format_context->streams[i]->codec->codec_type = input_format_context->streams[i]->codec->codec_type;
++        output_format_context->streams[i]->id =
++                input_format_context->streams[i]->id;
++        output_format_context->streams[i]->sample_aspect_ratio =
++                input_format_context->streams[i]->sample_aspect_ratio;
++        output_format_context->streams[i]->codec =
++                avcodec_alloc_context();
++        output_format_context->streams[i]->codec->sample_aspect_ratio =
++                output_format_context->streams[i]->sample_aspect_ratio;
++        output_format_context->streams[i]->codec->extradata =
++                input_format_context->streams[i]->codec->extradata;
++        output_format_context->streams[i]->codec->extradata_size =
++                input_format_context->streams[i]->codec->extradata_size;
++        output_format_context->streams[i]->codec->codec_type =
++                input_format_context->streams[i]->codec->codec_type;
+         if (input_format_context->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO) {
+             if(output_format_context->oformat->flags & AVFMT_GLOBALHEADER)
+                 output_format_context->streams[i]->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
+-            output_format_context->streams[i]->codec->pix_fmt = input_format_context->streams[i]->codec->pix_fmt;
+-            output_format_context->streams[i]->codec->time_base = input_format_context->streams[i]->codec->time_base;
+-            output_format_context->streams[i]->codec->width = input_format_context->streams[i]->codec->width;
+-            output_format_context->streams[i]->codec->height = input_format_context->streams[i]->codec->height;
+-        }
+-        else if (input_format_context->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO) {
+-            output_format_context->streams[i]->codec->sample_rate = input_format_context->streams[i]->codec->sample_rate;
++            output_format_context->streams[i]->codec->pix_fmt =
++                    input_format_context->streams[i]->codec->pix_fmt;
++            output_format_context->streams[i]->codec->time_base =
++                    input_format_context->streams[i]->codec->time_base;
++            output_format_context->streams[i]->codec->width =
++                    input_format_context->streams[i]->codec->width;
++            output_format_context->streams[i]->codec->height =
++                    input_format_context->streams[i]->codec->height;
+         }
+-        if (avcodec_open(output_format_context->streams[i]->codec, avcodec_find_encoder(input_format_context->streams[i]->codec->codec_id)) < 0) {
+-            fprintf(stderr, "Error: Could not open codec for stream %i in file %s\n", i, output_format_context->filename);
++        else if (input_format_context->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO)
++            output_format_context->streams[i]->codec->sample_rate =
++                    input_format_context->streams[i]->codec->sample_rate;
++        if (avcodec_open(output_format_context->streams[i]->codec,
++                avcodec_find_encoder(input_format_context->streams[i]->codec->codec_id)) < 0) {
++            fprintf(stderr, "Error: Could not open codec for stream %i in file %s\n",
++                    i, output_format_context->filename);
+             return -1;
+         }
+     }
+@@ -1676,14 +1706,17 @@ static int setup_output_file(AVFormatContext *output_format_context,
+ }
+ 
+ /**
+- * write_frames_to_output reads frames from the input format contexts
+- * and writes them to the output format context
+- * @param AVFormatContext **input_format_contexts list of input format contexts
+- * @param int num_input_files number of input files
+- * @param AVFormatContext *output_format_context format context for the output file
+- * @return returns 0 on success
++ * Reads frames from the input format contexts
++ * and writes them to the output format context.
++ * This is used internally by concatenation.
++ * @param AVFormatContext **input_format_contexts List of input format contexts.
++ * @param int num_input_files Number of input files.
++ * @param AVFormatContext *output_format_context Format context for the output file.
++ * @return Returns 0 on success.
+  */
+-static int write_frames_to_output(AVFormatContext **input_format_contexts, int num_input_files, AVFormatContext *output_format_context)
++static int write_frames_to_output(AVFormatContext **input_format_contexts,
++                                  int num_input_files,
++                                  AVFormatContext *output_format_context)
+ {
+     AVPacket *packet = av_malloc(sizeof(AVPacket));
+     int64_t packet_pts;
+@@ -1697,7 +1730,8 @@ static int write_frames_to_output(AVFormatContext **input_format_contexts, int n
+             packet->dts += packet_timestamp_offset;
+             packet_pts = packet->pts;
+             if (av_write_frame(output_format_context, packet) != 0) {
+-                fprintf(stderr, "Error writing frame to %s from input file %s\n", output_format_context->filename, input_format_contexts[i]->filename);
++                fprintf(stderr, "Error writing frame to %s from input file %s\n",
++                        output_format_context->filename, input_format_contexts[i]->filename);
+                 return -1;
+             }
+             av_free_packet(packet);
+-- 
+1.6.0.4
+

Added: concat/0007-attempting-same-format-concatenation-to-single-strea.patch
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ concat/0007-attempting-same-format-concatenation-to-single-strea.patch	Mon Apr 27 11:03:23 2009	(r4241)
@@ -0,0 +1,210 @@
+From 9c1e85370d63b9c04dd1453d2d74e3da5ac85089 Mon Sep 17 00:00:00 2001
+From: Geza Kovacs <gkovacs at mit.edu>
+Date: Mon, 27 Apr 2009 04:55:23 -0400
+Subject: [PATCH] attempting same-format concatenation to single stream, not yet working
+
+---
+ ffmpeg.c |   66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++------
+ 1 files changed, 59 insertions(+), 7 deletions(-)
+
+diff --git a/ffmpeg.c b/ffmpeg.c
+index 248e38f..84d7e5c 100644
+--- a/ffmpeg.c
++++ b/ffmpeg.c
+@@ -193,7 +193,7 @@ static char *vstats_filename;
+ static FILE *vstats_file;
+ static int opt_programid = 0;
+ static int copy_initial_nonkeyframes = 0;
+-static int concatenate_video_files = 0;
++static int concatenate_files = 0;
+ 
+ static int rate_emu = 0;
+ 
+@@ -1735,7 +1735,7 @@ static int write_frames_to_output(AVFormatContext **input_format_contexts,
+                 return -1;
+             }
+             av_free_packet(packet);
+-        
++
+         }
+         packet_timestamp_offset += packet_pts;
+     }
+@@ -1751,7 +1751,8 @@ static int av_encode(AVFormatContext **output_files,
+                      int nb_input_files,
+                      AVStreamMap *stream_maps, int nb_stream_maps)
+ {
+-    if (concatenate_video_files) {
++	/*
++    if (concatenate_files) {
+         printf("concatenating video files\n");
+         if (check_same_settings(input_files, nb_input_files) != 0) {
+             av_exit(1);
+@@ -1768,6 +1769,7 @@ static int av_encode(AVFormatContext **output_files,
+         printf("wrote frames to output\n");
+         return 0;
+     }
++    */
+     int ret = 0, i, j, k, n, nb_istreams = 0, nb_ostreams = 0;
+     AVFormatContext *is, *os;
+     AVCodecContext *codec, *icodec;
+@@ -1780,6 +1782,10 @@ static int av_encode(AVFormatContext **output_files,
+     uint8_t no_packet[MAX_FILES]={0};
+     int no_packet_count=0;
+ 
++    if (concatenate_files)
++        nb_output_files = 1;
++    int conc_inp_index;
++
+     file_table= av_mallocz(nb_input_files * sizeof(AVInputFile));
+     if (!file_table)
+         goto fail;
+@@ -2184,6 +2190,8 @@ static int av_encode(AVFormatContext **output_files,
+         ist->is_start = 1;
+     }
+ 
++    if (concatenate_files) verbose = 3;
++
+     /* set meta data information from input file if required */
+     for (i=0;i<nb_meta_data_maps;i++) {
+         AVFormatContext *out_file;
+@@ -2271,8 +2279,13 @@ static int av_encode(AVFormatContext **output_files,
+ 
+     key = -1;
+     timer_start = av_gettime();
+-
+-    for(; received_sigterm == 0;) {
++    conc_inp_index = 0;
++    if (concatenate_files) {
++        for (i=0;i<nb_istreams;i++) {
++            ist_table[i]->discard = 0;
++        }
++    }
++    for(; received_sigterm == 0;) { // main loop for encoding
+         int file_index, ist_index;
+         AVPacket pkt;
+         double ipts_min;
+@@ -2294,11 +2307,18 @@ static int av_encode(AVFormatContext **output_files,
+         /* select the stream that we must read now by looking at the
+            smallest output pts */
+         file_index = -1;
++
++        if (concatenate_files) file_index = conc_inp_index;
++
+         for(i=0;i<nb_ostreams;i++) {
+             double ipts, opts;
++            int input_stream_curindex;
++            input_stream_curindex = ost->source_index;
+             ost = ost_table[i];
+             os = output_files[ost->file_index];
+             ist = ist_table[ost->source_index];
++            if (concatenate_files) ist = ist_table[conc_inp_index];
++        nextist:
+             if(no_packet[ist->file_index])
+                 continue;
+             if(ost->st->codec->codec_type == CODEC_TYPE_VIDEO)
+@@ -2316,11 +2336,30 @@ static int av_encode(AVFormatContext **output_files,
+                     if(!input_sync) file_index = ist->file_index;
+                 }
+             }
++            if (file_table[ist->file_index].eof_reached && concatenate_files) {
++//                fprintf(stderr, "ist eof reached");
++                input_stream_curindex++;
++                if (input_stream_curindex < nb_istreams) {
++//                    fprintf(stderr, "moving onwards to next stream");
++                    fprintf(stderr, "values are %i %i\n", input_stream_curindex, nb_istreams);
++                    ist = ist_table[input_stream_curindex];
++                    conc_inp_index++;
++                    file_index = ist->file_index;
++                    fprintf(stderr, "new index is %i\n", file_index);
++                    file_table[ist->file_index].eof_reached = 0;
++//                    goto nextist;
++                }
++//                else {
++//                    break;
++//                }
++            }
+             if(ost->frame_number >= max_frames[ost->st->codec->codec_type]){
+                 file_index= -1;
+                 break;
+             }
+         }
++
++        if (file_index) fprintf(stderr, "file index is %i\n", file_index);
+         /* if none, if is finished */
+         if (file_index < 0) {
+             if(no_packet_count){
+@@ -2331,15 +2370,19 @@ static int av_encode(AVFormatContext **output_files,
+             }
+             break;
+         }
++        if (file_index) fprintf(stderr, "made it to checkpoint 1\n");
+ 
+         /* finish if recording time exhausted */
+-        if (opts_min >= (recording_time / 1000000.0))
++        if (opts_min >= (recording_time / 1000000.0) && !concatenate_files)
+             break;
++        if (file_index) fprintf(stderr, "made it to checkpoint 1-2\n");
+ 
+         /* finish if limit size exhausted */
+         if (limit_filesize != 0 && limit_filesize < url_ftell(output_files[0]->pb))
+             break;
++        if (file_index) fprintf(stderr, "made it to checkpoint 1-3\n");
+ 
++        if (file_index) fprintf(stderr, "made it to checkpoint 2\n");
+         /* read a frame from it and output it in the fifo */
+         is = input_files[file_index];
+         ret= av_read_frame(is, &pkt);
+@@ -2348,6 +2391,7 @@ static int av_encode(AVFormatContext **output_files,
+             no_packet_count++;
+             continue;
+         }
++        if (file_index) fprintf(stderr, "made it to checkpoint 2-2\n");
+         if (ret < 0) {
+             file_table[file_index].eof_reached = 1;
+             if (opt_shortest)
+@@ -2355,6 +2399,7 @@ static int av_encode(AVFormatContext **output_files,
+             else
+                 continue;
+         }
++        if (file_index) fprintf(stderr, "made it to checkpoint 3\n");
+ 
+         no_packet_count=0;
+         memset(no_packet, 0, sizeof(no_packet));
+@@ -2366,11 +2411,16 @@ static int av_encode(AVFormatContext **output_files,
+            dynamically in stream : we ignore them */
+         if (pkt.stream_index >= file_table[file_index].nb_streams)
+             goto discard_packet;
++
++        if (file_index) fprintf(stderr, "made it to checkpoint 4\n");
++
+         ist_index = file_table[file_index].ist_index + pkt.stream_index;
+         ist = ist_table[ist_index];
+         if (ist->discard)
+             goto discard_packet;
+ 
++        if (file_index) fprintf(stderr, "made it to checkpoint 5\n");
++
+         if (pkt.dts != AV_NOPTS_VALUE)
+             pkt.dts += av_rescale_q(input_files_ts_offset[ist->file_index], AV_TIME_BASE_Q, ist->st->time_base);
+         if (pkt.pts != AV_NOPTS_VALUE)
+@@ -2383,6 +2433,8 @@ static int av_encode(AVFormatContext **output_files,
+                 pkt.dts *= input_files_ts_scale[file_index][pkt.stream_index];
+         }
+ 
++        if (file_index) fprintf(stderr, "made it to checkpoint 6\n");
++
+ //        fprintf(stderr, "next:%"PRId64" dts:%"PRId64" off:%"PRId64" %d\n", ist->next_pts, pkt.dts, input_files_ts_offset[ist->file_index], ist->st->codec->codec_type);
+         if (pkt.dts != AV_NOPTS_VALUE && ist->next_pts != AV_NOPTS_VALUE
+             && (is->iformat->flags & AVFMT_TS_DISCONT)) {
+@@ -4048,7 +4100,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" },
++    { "conc", OPT_BOOL, {(void*)&concatenate_files}, "concatenate video files", "concatenate" },
+ 
+     /* video options */
+     { "b", OPT_FUNC2 | HAS_ARG | OPT_VIDEO, {(void*)opt_bitrate}, "set bitrate (in bits/s)", "bitrate" },
+-- 
+1.6.0.4
+


More information about the FFmpeg-soc mailing list