[FFmpeg-devel] [PATCH] Remove hard limit on number of files

Michael Niedermayer michaelni
Fri Feb 5 20:17:35 CET 2010


On Tue, Feb 02, 2010 at 12:52:55PM -0200, Lucas Clemente Vella wrote:
> Here.
> 
> -- 
> Lucas Clemente Vella
> lvella at gmail.com

>  ffmpeg.c |  266 +++++++++++++++++++++++++++++++++++++++------------------------
>  1 file changed, 167 insertions(+), 99 deletions(-)
> eed361a815e09c07b2eed16864cadf6cf1360c54  no_file_limit.patch
> diff --git a/ffmpeg.c b/ffmpeg.c
> index e82194f..1f094f1 100644
> --- a/ffmpeg.c
> +++ b/ffmpeg.c
> @@ -89,26 +89,32 @@ typedef struct AVMetaDataMap {
>  
>  static const OptionDef options[];
>  
> -#define MAX_FILES 100
> -
>  static const char *last_asked_format = NULL;
> -static AVFormatContext *input_files[MAX_FILES];
> -static int64_t input_files_ts_offset[MAX_FILES];
> -static double input_files_ts_scale[MAX_FILES][MAX_STREAMS];
> -static AVCodec *input_codecs[MAX_FILES*MAX_STREAMS];
> +
> +typedef struct InputFileContext {
> +    double input_file_ts_scale[MAX_STREAMS];
> +    int64_t input_file_ts_offset;
> +	AVFormatContext *format;

tabs are forbidden in our svn
also try tools/patcheck please

[...]

> -static int nb_stream_maps;
> +static int nb_stream_maps = 0;

unrelated and rejected


[...]
>                  /* Sanity check that the stream types match */
>                  if (ist_table[ost->source_index]->st->codec->codec_type != ost->st->codec->codec_type) {
>                      int i= ost->file_index;
> -                    dump_format(output_files[i], i, output_files[i]->filename, 1);
> +                    /* Shouldn't be output_files[k] ? */
> +                    dump_format(output_files[i].format, i, output_files[i].format->filename, 1);
>                      fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> #%d.%d\n",
>                          stream_maps[n].file_index, stream_maps[n].stream_index,
>                          ost->file_index, ost->index);

if you think theres a bug that goes in a sperate patch with explanation
of what is buggy
please dont put such questions in patches

[...]
> -static void new_audio_stream(AVFormatContext *oc)
> +static void new_audio_stream(OutputFileContext *fc)
>  {
> +    AVFormatContext *oc;
>      AVStream *st;
>      AVCodecContext *audio_enc;
>      enum CodecID codec_id;
>  
> +    oc = fc->format;
> +
>      st = av_new_stream(oc, oc->nb_streams);
>      if (!st) {
>          fprintf(stderr, "Could not alloc stream\n");
> @@ -3212,7 +3268,7 @@ static void new_audio_stream(AVFormatContext *oc)
>      }
>      avcodec_get_context_defaults2(st->codec, CODEC_TYPE_AUDIO);
>  
> -    bitstream_filters[nb_output_files][oc->nb_streams - 1]= audio_bitstream_filters;
> +    fc->bitstream_filters[oc->nb_streams - 1]= audio_bitstream_filters;
>      audio_bitstream_filters= NULL;
>  
>      avcodec_thread_init(st->codec, thread_count);

this appears to be an unrelated change


> @@ -3238,7 +3294,7 @@ static void new_audio_stream(AVFormatContext *oc)
>          if (audio_codec_name) {
>              codec_id = find_codec_or_die(audio_codec_name, CODEC_TYPE_AUDIO, 1);
>              codec = avcodec_find_encoder_by_name(audio_codec_name);
> -            output_codecs[nb_ocodecs] = codec;
> +            fc->codecs[fc->nb_codecs] = codec;

same


>          } else {
>              codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, CODEC_TYPE_AUDIO);
>              codec = avcodec_find_encoder(codec_id);
> @@ -3265,7 +3321,7 @@ static void new_audio_stream(AVFormatContext *oc)
>                  audio_enc->sample_fmt = codec->sample_fmts[0];
>          }
>      }
> -    nb_ocodecs++;
> +    fc->nb_codecs++;

...

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

> ... defining _GNU_SOURCE...
For the love of all that is holy, and some that is not, don't do that.
-- Luca & Mans
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100205/83dececd/attachment.pgp>



More information about the ffmpeg-devel mailing list