OSDN Git Service

Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 26 Jun 2012 23:58:09 +0000 (01:58 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 26 Jun 2012 23:58:09 +0000 (01:58 +0200)
* qatar/master:
  avconv: add an assert to silence an uninitialized variable warning.
  avconv: shut up an uninitialized variable warning.
  avfiltergraph: shut up uninitialized variable warning.
  af_join: initialize a variable to shut up gcc warning.
  amix: fix format specifier for AVFilterLink.sample_rate.
  lavfi: make filters less verbose.
  mpc8: read APE tags.
  lavr: x86: fix ff_conv_fltp_to_flt_6ch function prototypes
  libm: provide fallback definition for cbrtf() using powf()
  network: Don't redefine error codes if they already exist in errno.h
  configure: Check for sys/time.h
  network: Include unistd.h from network.h
  avconv: don't include vsrc_buffer.h, which doesn't exist anymore
  lavfi: reorder AVFilterLink fields.
  lavfi: reorder AVFilterContext fields.
  lavfi: reorder AVFilter fields.
  lavfi: reorder AVFilterBufferRef fields.
  lavfi: reorder AVFilterBuffer fields.

Conflicts:
configure
libavcodec/v210dec.h
libavfilter/asrc_anullsrc.c
libavfilter/avfilter.h
libavfilter/buffersrc.c
libavfilter/src_movie.c
libavfilter/vf_aspect.c
libavfilter/vf_crop.c
libavfilter/vf_drawbox.c
libavfilter/vf_fade.c
libavfilter/vf_overlay.c
libavfilter/vf_pad.c
libavfilter/vf_scale.c
libavfilter/vsrc_color.c
libavformat/network.h
libavutil/libm.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
36 files changed:
1  2 
configure
ffmpeg.c
libavfilter/af_amix.c
libavfilter/asrc_anullsrc.c
libavfilter/avfilter.c
libavfilter/avfilter.h
libavfilter/avfiltergraph.c
libavfilter/fifo.c
libavfilter/src_movie.c
libavfilter/vf_aspect.c
libavfilter/vf_blackframe.c
libavfilter/vf_crop.c
libavfilter/vf_cropdetect.c
libavfilter/vf_drawbox.c
libavfilter/vf_fade.c
libavfilter/vf_fieldorder.c
libavfilter/vf_frei0r.c
libavfilter/vf_gradfun.c
libavfilter/vf_hqdn3d.c
libavfilter/vf_libopencv.c
libavfilter/vf_overlay.c
libavfilter/vf_pad.c
libavfilter/vf_setpts.c
libavfilter/vf_settb.c
libavfilter/vf_transpose.c
libavfilter/vf_unsharp.c
libavfilter/vf_yadif.c
libavfilter/vsrc_color.c
libavformat/Makefile
libavformat/mpc8.c
libavformat/network.c
libavformat/network.h
libavformat/os_support.c
libavformat/tcp.c
libavformat/udp.c
libavutil/libm.h

diff --cc configure
+++ b/configure
@@@ -1275,8 -1149,8 +1275,9 @@@ HAVE_LIST=
      sys_resource_h
      sys_select_h
      sys_soundcard_h
+     sys_time_h
      sys_videoio_h
 +    termios_h
      threads
      trunc
      truncf
@@@ -3187,7 -2875,7 +3188,8 @@@ check_header sys/mman.
  check_header sys/param.h
  check_header sys/resource.h
  check_header sys/select.h
+ check_header sys/time.h
 +check_header termios.h
  check_header unistd.h
  check_header vdpau/vdpau.h
  check_header vdpau/vdpau_x11.h
diff --cc ffmpeg.c
Simple merge
Simple merge
@@@ -86,14 -63,14 +86,14 @@@ static int config_props(AVFilterLink *o
      char buf[128];
      int chans_nb;
  
 -    outlink->sample_rate = priv->sample_rate;
 -    outlink->channel_layout = priv->channel_layout;
 +    outlink->sample_rate = null->sample_rate;
 +    outlink->channel_layout = null->channel_layout;
  
 -    chans_nb = av_get_channel_layout_nb_channels(priv->channel_layout);
 -    av_get_channel_layout_string(buf, sizeof(buf), chans_nb, priv->channel_layout);
 +    chans_nb = av_get_channel_layout_nb_channels(null->channel_layout);
 +    av_get_channel_layout_string(buf, sizeof(buf), chans_nb, null->channel_layout);
-     av_log(outlink->src, AV_LOG_INFO,
+     av_log(outlink->src, AV_LOG_VERBOSE,
 -           "sample_rate:%"PRId64 " channel_layout:%"PRId64 " channel_layout_description:'%s'\n",
 -           priv->sample_rate, priv->channel_layout, buf);
 +           "sample_rate:%d channel_layout:'%s' nb_samples:%d\n",
 +           null->sample_rate, buf, null->nb_samples);
  
      return 0;
  }
Simple merge
@@@ -413,28 -406,7 +428,21 @@@ typedef struct AVFilter 
       */
      int (*query_formats)(AVFilterContext *);
  
-     const AVFilterPad *inputs;  ///< NULL terminated list of inputs. NULL if none
-     const AVFilterPad *outputs; ///< NULL terminated list of outputs. NULL if none
-     /**
-      * A description for the filter. You should use the
-      * NULL_IF_CONFIG_SMALL() macro to define it.
-      */
-     const char *description;
+     int priv_size;      ///< size of private data to allocate for the filter
 +
 +    /**
 +     * Make the filter instance process a command.
 +     *
 +     * @param cmd    the command to process, for handling simplicity all commands must be alphanumeric only
 +     * @param arg    the argument for the command
 +     * @param res    a buffer with size res_size where the filter(s) can return a response. This must not change when the command is not supported.
 +     * @param flags  if AVFILTER_CMD_FLAG_FAST is set and the command would be
 +     *               time consuming then a filter should treat it like an unsupported command
 +     *
 +     * @returns >=0 on success otherwise an error code.
 +     *          AVERROR(ENOSYS) on unsupported commands
 +     */
 +    int (*process_command)(AVFilterContext *, const char *cmd, const char *arg, char *res, int res_len, int flags);
  } AVFilter;
  
  /** An instance of a filter */
@@@ -454,15 -429,9 +465,11 @@@ struct AVFilterContext 
  #if FF_API_FOO_COUNT
      unsigned output_count;          ///< @deprecated use nb_outputs
  #endif
-     AVFilterPad   *output_pads;     ///< array of output pads
-     AVFilterLink **outputs;         ///< array of pointers to output links
+     unsigned    nb_outputs;         ///< number of output pads
  
      void *priv;                     ///< private data for use by the filter
-     unsigned nb_inputs;             ///< number of input pads
-     unsigned nb_outputs;            ///< number of output pads
 +
 +    struct AVFilterCommand *command_queue;
  };
  
  /**
@@@ -537,6 -477,14 +515,16 @@@ struct AVFilterLink 
       *****************************************************************
       */
      /**
 -     * Lists of formats supported by the input and output filters respectively.
 -     * These lists are used for negotiating the format to actually be used,
 -     * which will be loaded into the format member, above, when chosen.
++     * Lists of formats and channel layouts supported by the input and output
++     * filters respectively. These lists are used for negotiating the format
++     * to actually be used, which will be loaded into the format and
++     * channel_layout members, above, when chosen.
++     *
+      */
+     AVFilterFormats *in_formats;
+     AVFilterFormats *out_formats;
+     /**
       * Lists of channel layouts and sample rates used for automatic
       * negotiation.
       */
       */
      int request_samples;
  
+     /** stage of the initialization of the link properties (dimensions, etc) */
+     enum {
+         AVLINK_UNINIT = 0,      ///< not started
+         AVLINK_STARTINIT,       ///< started, but incomplete
+         AVLINK_INIT             ///< complete
+     } init_state;
+     /**
+      * The buffer reference currently being sent across the link by the source
+      * filter. This is used internally by the filter system to allow
+      * automatic copying of buffers which do not have sufficient permissions
+      * for the destination. This should not be accessed directly by the
+      * filters.
+      */
+     AVFilterBufferRef *src_buf;
+     AVFilterBufferRef *cur_buf;
+     AVFilterBufferRef *out_buf;
++
 +    struct AVFilterPool *pool;
 +
 +    /**
 +     * Graph the filter belongs to.
 +     */
 +    struct AVFilterGraph *graph;
 +
 +    /**
 +     * Current timestamp of the link, as defined by the most recent
 +     * frame(s), in AV_TIME_BASE units.
 +     */
 +    int64_t current_pts;
 +
 +    /**
 +     * Index in the age array.
 +     */
 +    int age_index;
 +
 +    /**
 +     * Frame rate of the stream on the link, or 1/0 if unknown;
 +     * if left to 0/0, will be automatically be copied from the first input
 +     * of the source filter if it exists.
 +     *
 +     * Sources should set it to the best estimation of the real frame rate.
 +     * Filters should update it if necessary depending on their function.
 +     * Sinks can use it to set a default output frame rate.
 +     * It is similar to the r_frae_rate field in AVStream.
 +     */
 +    AVRational frame_rate;
  };
  
  /**
Simple merge
Simple merge
@@@ -167,7 -147,15 +167,7 @@@ static av_cold int movie_common_init(AV
          return ret;
      }
  
-     av_log(ctx, AV_LOG_INFO, "seek_point:%"PRIi64" format_name:%s file_name:%s stream_index:%d\n",
 -    if (!(movie->frame = avcodec_alloc_frame()) ) {
 -        av_log(ctx, AV_LOG_ERROR, "Failed to alloc frame\n");
 -        return AVERROR(ENOMEM);
 -    }
 -
 -    movie->w = movie->codec_ctx->width;
 -    movie->h = movie->codec_ctx->height;
 -
+     av_log(ctx, AV_LOG_VERBOSE, "seek_point:%"PRIi64" format_name:%s file_name:%s stream_index:%d\n",
             movie->seek_point, movie->format_name, movie->file_name,
             movie->stream_index);
  
@@@ -45,9 -49,18 +45,9 @@@ static av_cold int init(AVFilterContex
                     "Invalid string '%s' for aspect ratio.\n", args);
              return AVERROR(EINVAL);
          }
 -
 -        gcd = av_gcd(FFABS(aspect->aspect.num), FFABS(aspect->aspect.den));
 -        if (gcd) {
 -            aspect->aspect.num /= gcd;
 -            aspect->aspect.den /= gcd;
 -        }
      }
  
-     av_log(ctx, AV_LOG_INFO, "a:%d/%d\n", aspect->ratio.num, aspect->ratio.den);
 -    if (aspect->aspect.den == 0)
 -        aspect->aspect = (AVRational) {0, 1};
 -
 -    av_log(ctx, AV_LOG_VERBOSE, "a:%d/%d\n", aspect->aspect.num, aspect->aspect.den);
++    av_log(ctx, AV_LOG_VERBOSE, "a:%d/%d\n", aspect->ratio.num, aspect->ratio.den);
      return 0;
  }
  
@@@ -63,16 -76,17 +63,16 @@@ static void start_frame(AVFilterLink *l
  static int setdar_config_props(AVFilterLink *inlink)
  {
      AspectContext *aspect = inlink->dst->priv;
 -    AVRational dar = aspect->aspect;
 +    AVRational dar = aspect->ratio;
  
 -    av_reduce(&aspect->aspect.num, &aspect->aspect.den,
 -               aspect->aspect.num * inlink->h,
 -               aspect->aspect.den * inlink->w, 100);
 +    av_reduce(&aspect->ratio.num, &aspect->ratio.den,
 +               aspect->ratio.num * inlink->h,
 +               aspect->ratio.den * inlink->w, 100);
  
-     av_log(inlink->dst, AV_LOG_INFO, "w:%d h:%d -> dar:%d/%d sar:%d/%d\n",
+     av_log(inlink->dst, AV_LOG_VERBOSE, "w:%d h:%d -> dar:%d/%d sar:%d/%d\n",
 -           inlink->w, inlink->h, dar.num, dar.den, aspect->aspect.num, aspect->aspect.den);
 +           inlink->w, inlink->h, dar.num, dar.den, aspect->ratio.num, aspect->ratio.den);
  
 -    inlink->sample_aspect_ratio = aspect->aspect;
 +    inlink->sample_aspect_ratio = aspect->ratio;
  
      return 0;
  }
Simple merge
@@@ -216,17 -207,8 +216,17 @@@ static int config_input(AVFilterLink *l
                               NULL, NULL, NULL, NULL, 0, ctx)) < 0)
          return AVERROR(EINVAL);
  
 -    av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d -> w:%d h:%d\n",
 -           link->w, link->h, crop->w, crop->h);
 +    if (crop->keep_aspect) {
 +        AVRational dar = av_mul_q(link->sample_aspect_ratio,
 +                                  (AVRational){ link->w, link->h });
 +        av_reduce(&crop->out_sar.num, &crop->out_sar.den,
 +                  dar.num * crop->h, dar.den * crop->w, INT_MAX);
 +    } else
 +        crop->out_sar = link->sample_aspect_ratio;
 +
-     av_log(ctx, AV_LOG_INFO, "w:%d h:%d sar:%d/%d -> w:%d h:%d sar:%d/%d\n",
++    av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d sar:%d/%d -> w:%d h:%d sar:%d/%d\n",
 +           link->w, link->h, link->sample_aspect_ratio.num, link->sample_aspect_ratio.den,
 +           crop->w, crop->h, crop->out_sar.num, crop->out_sar.den);
  
      if (crop->w <= 0 || crop->h <= 0 ||
          crop->w > link->w || crop->h > link->h) {
Simple merge
@@@ -87,8 -87,8 +87,8 @@@ static int config_input(AVFilterLink *i
      if (drawbox->w == 0) drawbox->w = inlink->w;
      if (drawbox->h == 0) drawbox->h = inlink->h;
  
-     av_log(inlink->dst, AV_LOG_INFO, "x:%d y:%d w:%d h:%d color:0x%02X%02X%02X%02X\n",
+     av_log(inlink->dst, AV_LOG_VERBOSE, "x:%d y:%d w:%d h:%d color:0x%02X%02X%02X%02X\n",
 -           drawbox->w, drawbox->y, drawbox->w, drawbox->h,
 +           drawbox->x, drawbox->y, drawbox->w, drawbox->h,
             drawbox->yuv_color[Y], drawbox->yuv_color[U], drawbox->yuv_color[V], drawbox->yuv_color[A]);
  
      return 0;
@@@ -120,26 -59,15 +120,26 @@@ static av_cold int init(AVFilterContex
          fade->factor = (1 << 16);
      } else {
          av_log(ctx, AV_LOG_ERROR,
 -               "first argument must be 'in' or 'out':'%s'\n", in_out);
 -        return AVERROR(EINVAL);
 +               "Type argument must be 'in' or 'out' but '%s' was specified\n", fade->type);
 +        ret = AVERROR(EINVAL);
 +        goto end;
      }
 -    fade->stop_frame = fade->start_frame + nb_frames;
 +    fade->stop_frame = fade->start_frame + fade->nb_frames;
  
-     av_log(ctx, AV_LOG_INFO,
+     av_log(ctx, AV_LOG_VERBOSE,
 -           "type:%s start_frame:%d nb_frames:%d\n",
 -           in_out, fade->start_frame, nb_frames);
 -    return 0;
 +           "type:%s start_frame:%d nb_frames:%d alpha:%d\n",
 +           fade->type, fade->start_frame, fade->nb_frames, fade->alpha);
 +
 +end:
 +    av_free(args1);
 +    return ret;
 +}
 +
 +static av_cold void uninit(AVFilterContext *ctx)
 +{
 +    FadeContext *fade = ctx->priv;
 +
 +    av_freep(&fade->type);
  }
  
  static int query_formats(AVFilterContext *ctx)
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -241,11 -151,7 +241,11 @@@ static int config_input_overlay(AVFilte
          goto fail;
      over->x = res;
  
-     av_log(ctx, AV_LOG_INFO,
 +    over->overlay_is_packed_rgb =
 +        ff_fill_rgba_map(over->overlay_rgba_map, inlink->format) >= 0;
 +    over->overlay_has_alpha = ff_fmt_is_in(inlink->format, alpha_pix_fmts);
 +
+     av_log(ctx, AV_LOG_VERBOSE,
             "main w:%d h:%d fmt:%s overlay x:%d y:%d w:%d h:%d fmt:%s\n",
             ctx->inputs[MAIN]->w, ctx->inputs[MAIN]->h,
             av_pix_fmt_descriptors[ctx->inputs[MAIN]->format].name,
@@@ -177,16 -208,22 +177,16 @@@ static int config_input(AVFilterLink *i
      if (!pad->h)
          pad->h = inlink->h;
  
 -    pad->w &= ~((1 << pad->hsub) - 1);
 -    pad->h &= ~((1 << pad->vsub) - 1);
 -    pad->x &= ~((1 << pad->hsub) - 1);
 -    pad->y &= ~((1 << pad->vsub) - 1);
 -
 -    pad->in_w = inlink->w & ~((1 << pad->hsub) - 1);
 -    pad->in_h = inlink->h & ~((1 << pad->vsub) - 1);
 +    pad->w    = ff_draw_round_to_sub(&pad->draw, 0, -1, pad->w);
 +    pad->h    = ff_draw_round_to_sub(&pad->draw, 1, -1, pad->h);
 +    pad->x    = ff_draw_round_to_sub(&pad->draw, 0, -1, pad->x);
 +    pad->y    = ff_draw_round_to_sub(&pad->draw, 1, -1, pad->y);
 +    pad->in_w = ff_draw_round_to_sub(&pad->draw, 0, -1, inlink->w);
 +    pad->in_h = ff_draw_round_to_sub(&pad->draw, 1, -1, inlink->h);
  
-     av_log(ctx, AV_LOG_INFO, "w:%d h:%d -> w:%d h:%d x:%d y:%d color:0x%02X%02X%02X%02X\n",
 -    memcpy(rgba_color, pad->color, sizeof(rgba_color));
 -    ff_fill_line_with_color(pad->line, pad->line_step, pad->w, pad->color,
 -                            inlink->format, rgba_color, &is_packed_rgba, NULL);
 -
 -    av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d -> w:%d h:%d x:%d y:%d color:0x%02X%02X%02X%02X[%s]\n",
++    av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d -> w:%d h:%d x:%d y:%d color:0x%02X%02X%02X%02X\n",
             inlink->w, inlink->h, pad->w, pad->h, pad->x, pad->y,
 -           pad->color[0], pad->color[1], pad->color[2], pad->color[3],
 -           is_packed_rgba ? "rgba" : "yuva");
 +           pad->rgba_color[0], pad->rgba_color[1], pad->rgba_color[2], pad->rgba_color[3]);
  
      if (pad->x <  0 || pad->y <  0                      ||
          pad->w <= 0 || pad->h <= 0                      ||
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -135,9 -123,14 +135,9 @@@ static int color_config_props(AVFilterL
      if (av_image_check_size(color->w, color->h, 0, ctx) < 0)
          return AVERROR(EINVAL);
  
-     av_log(ctx, AV_LOG_INFO, "w:%d h:%d r:%d/%d color:0x%02x%02x%02x%02x\n",
 -    memcpy(rgba_color, color->color, sizeof(rgba_color));
 -    ff_fill_line_with_color(color->line, color->line_step, color->w, color->color,
 -                            inlink->format, rgba_color, &is_packed_rgba, NULL);
 -
 -    av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d r:%d/%d color:0x%02x%02x%02x%02x[%s]\n",
++    av_log(ctx, AV_LOG_VERBOSE, "w:%d h:%d r:%d/%d color:0x%02x%02x%02x%02x\n",
             color->w, color->h, color->time_base.den, color->time_base.num,
 -           color->color[0], color->color[1], color->color[2], color->color[3],
 -           is_packed_rgba ? "rgba" : "yuva");
 +           color->color_rgba[0], color->color_rgba[1], color->color_rgba[2], color->color_rgba[3]);
      inlink->w = color->w;
      inlink->h = color->h;
      inlink->time_base = color->time_base;
Simple merge
@@@ -239,9 -240,13 +240,15 @@@ static int mpc8_read_header(AVFormatCon
      avpriv_set_pts_info(st, 32, 1152  << (st->codec->extradata[1]&3)*2, st->codec->sample_rate);
      st->duration = c->samples / (1152 << (st->codec->extradata[1]&3)*2);
      size -= avio_tell(pb) - pos;
 +    if (size > 0)
 +        avio_skip(pb, size);
  
+     if (pb->seekable) {
+         int64_t pos = avio_tell(s->pb);
+         ff_ape_parse_tag(s);
+         avio_seek(s->pb, pos, SEEK_SET);
+     }
      return 0;
  }
  
Simple merge
Simple merge
Simple merge
Simple merge
  #include "avformat.h"
  #include "avio_internal.h"
  #include "libavutil/parseutils.h"
 +#include "libavutil/fifo.h"
 +#include "libavutil/intreadwrite.h"
  #include "libavutil/avstring.h"
- #include <unistd.h>
  #include "internal.h"
  #include "network.h"
  #include "os_support.h"
  #include "config.h"
  #include "attributes.h"
  
 +#if HAVE_MIPSFPU && HAVE_INLINE_ASM
 +#include "libavutil/mips/libm_mips.h"
 +#endif /* HAVE_MIPSFPU && HAVE_INLINE_ASM*/
 +
  #if !HAVE_CBRTF
- #undef cbrtf
- #define cbrtf(x) powf(x, 1.0/3.0)
- #endif /* HAVE_CBRTF */
+ static av_always_inline float cbrtf(float x)
+ {
+     return x < 0 ? -powf(-x, 1.0 / 3.0) : powf(x, 1.0 / 3.0);
+ }
+ #endif
  
  #if !HAVE_EXP2
  #undef exp2