Merge remote branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 10 May 2011 02:01:29 +0000 (04:01 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 10 May 2011 02:03:17 +0000 (04:03 +0200)
* qatar/master:
  mpegaudiodec: group #includes more sanely
  mpegaudio: remove #if 0 blocks
  ffmpeg.c: reset avoptions after each input/output file.
  ffmpeg.c: store per-output stream sws flags.
  mpegaudio: remove CONFIG_MPEGAUDIO_HP option
  mpegtsenc: Clear st->priv_data when freeing it
  udp: Fix receiving RTP data over multicast
  rtpproto: Remove an unused variable
  regtest: fix wma tests
NOT pulled:  mpegaudio: remove CONFIG_AUDIO_NONSHORT
  regtest: separate flags for encoding and decoding

Conflicts:
ffmpeg.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
14 files changed:
1  2 
cmdutils.c
configure
ffmpeg.c
libavcodec/Makefile
libavcodec/bfin/mathops.h
libavcodec/mpegaudio.h
libavcodec/mpegaudio_tablegen.h
libavcodec/mpegaudiodec.c
libavcodec/mpegaudioenc.c
libavformat/mpegtsenc.c
libavformat/rtpproto.c
libavformat/udp.c
tests/codec-regression.sh
tests/lavfi-regression.sh

diff --cc cmdutils.c
Simple merge
diff --cc configure
Simple merge
diff --cc ffmpeg.c
+++ b/ffmpeg.c
@@@ -309,13 -302,7 +309,15 @@@ typedef struct AVOutputStream 
      AVFifoBuffer *fifo;     /* for compression: one audio fifo per codec */
      FILE *logfile;
  
 +#if CONFIG_AVFILTER
 +    AVFilterContext *output_video_filter;
 +    AVFilterContext *input_video_filter;
 +    AVFilterBufferRef *picref;
 +    char *avfilter;
 +    AVFilterGraph *graph;
 +#endif
++
+    int sws_flags;
  } AVOutputStream;
  
  static AVOutputStream **output_streams_for_file[MAX_FILES] = { NULL };
@@@ -393,19 -378,19 +395,19 @@@ static int configure_video_filters(AVIn
          snprintf(args, 255, "%d:%d:flags=0x%X",
                   codec->width,
                   codec->height,
-                  (int)av_get_int(sws_opts, "sws_flags", NULL));
+                  ost->sws_flags);
          if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
 -                                                NULL, args, NULL, graph)) < 0)
 +                                                NULL, args, NULL, ost->graph)) < 0)
              return ret;
          if ((ret = avfilter_link(last_filter, 0, filter, 0)) < 0)
              return ret;
          last_filter = filter;
      }
  
-     snprintf(args, sizeof(args), "flags=0x%X", (int)av_get_int(sws_opts, "sws_flags", NULL));
+     snprintf(args, sizeof(args), "flags=0x%X", ost->sws_flags);
 -    graph->scale_sws_opts = av_strdup(args);
 +    ost->graph->scale_sws_opts = av_strdup(args);
  
 -    if (vfilters) {
 +    if (ost->avfilter) {
          AVFilterInOut *outputs = av_malloc(sizeof(AVFilterInOut));
          AVFilterInOut *inputs  = av_malloc(sizeof(AVFilterInOut));
  
@@@ -1192,45 -1121,36 +1196,44 @@@ static void do_video_out(AVFormatContex
  
      formatted_picture = in_picture;
      final_picture = formatted_picture;
 -    padding_src = formatted_picture;
 -    resampling_dst = &ost->pict_tmp;
 -
 -    if (   ost->resample_height != ist->st->codec->height
 -        || ost->resample_width  != ist->st->codec->width
 -        || (ost->resample_pix_fmt!= ist->st->codec->pix_fmt) ) {
  
 -        fprintf(stderr,"Input Stream #%d.%d frame size changed to %dx%d, %s\n", ist->file_index, ist->index, ist->st->codec->width,     ist->st->codec->height,avcodec_get_pix_fmt_name(ist->st->codec->pix_fmt));
 -        if(!ost->video_resample)
 -            ffmpeg_exit(1);
 +#if !CONFIG_AVFILTER
 +    resample_changed = ost->resample_width   != dec->width  ||
 +                       ost->resample_height  != dec->height ||
 +                       ost->resample_pix_fmt != dec->pix_fmt;
 +
 +    if (resample_changed) {
 +        av_log(NULL, AV_LOG_INFO,
 +               "Input stream #%d.%d frame changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s\n",
 +               ist->file_index, ist->index,
 +               ost->resample_width, ost->resample_height, avcodec_get_pix_fmt_name(ost->resample_pix_fmt),
 +               dec->width         , dec->height         , avcodec_get_pix_fmt_name(dec->pix_fmt));
 +        ost->resample_width   = dec->width;
 +        ost->resample_height  = dec->height;
 +        ost->resample_pix_fmt = dec->pix_fmt;
      }
  
 -#if !CONFIG_AVFILTER
 -    if (ost->video_resample) {
 -        padding_src = NULL;
 -        final_picture = &ost->pict_tmp;
 -        if(  ost->resample_height != ist->st->codec->height
 -          || ost->resample_width  != ist->st->codec->width
 -          || (ost->resample_pix_fmt!= ist->st->codec->pix_fmt) ) {
 +    ost->video_resample = dec->width   != enc->width  ||
 +                          dec->height  != enc->height ||
 +                          dec->pix_fmt != enc->pix_fmt;
  
 +    if (ost->video_resample) {
 +        final_picture = &ost->resample_frame;
 +        if (!ost->img_resample_ctx || resample_changed) {
 +            /* initialize the destination picture */
 +            if (!ost->resample_frame.data[0]) {
 +                avcodec_get_frame_defaults(&ost->resample_frame);
 +                if (avpicture_alloc((AVPicture *)&ost->resample_frame, enc->pix_fmt,
 +                                    enc->width, enc->height)) {
 +                    fprintf(stderr, "Cannot allocate temp picture, check pix fmt\n");
 +                    ffmpeg_exit(1);
 +                }
 +            }
              /* initialize a new scaler context */
              sws_freeContext(ost->img_resample_ctx);
-             sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
 -            ost->img_resample_ctx = sws_getContext(
 -                ist->st->codec->width,
 -                ist->st->codec->height,
 -                ist->st->codec->pix_fmt,
 -                ost->st->codec->width,
 -                ost->st->codec->height,
 -                ost->st->codec->pix_fmt,
 -                ost->sws_flags, NULL, NULL, NULL);
 +            ost->img_resample_ctx = sws_getContext(dec->width, dec->height, dec->pix_fmt,
 +                                                   enc->width, enc->height, enc->pix_fmt,
-                                                    sws_flags, NULL, NULL, NULL);
++                                                   ost->sws_flags, NULL, NULL, NULL);
              if (ost->img_resample_ctx == NULL) {
                  fprintf(stderr, "Cannot get resampling context\n");
                  ffmpeg_exit(1);
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge