]> git.sesse.net Git - ffmpeg/commitdiff
Merge commit '48ff6683ba5d40b629428673b1028e8ec542a9fa'
authorHendrik Leppkes <h.leppkes@gmail.com>
Wed, 11 Nov 2015 13:45:24 +0000 (14:45 +0100)
committerHendrik Leppkes <h.leppkes@gmail.com>
Wed, 11 Nov 2015 13:47:29 +0000 (14:47 +0100)
* commit '48ff6683ba5d40b629428673b1028e8ec542a9fa':
  lavfi: add a frame_rate field to AVFilterLink.

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
1  2 
libavfilter/avfilter.c
libavfilter/avfilter.h

index 7dc8b482be554836e583c29c75b7d273ba8f2e69,cd98d16220691d4c7b537ee4351e958b93c55300..c5c30448dc05b88ac4112472edc0097e857b75fe
@@@ -266,23 -185,22 +266,22 @@@ int avfilter_config_links(AVFilterConte
                  return ret;
              }
  
 -            if (link->time_base.num == 0 && link->time_base.den == 0)
 -                link->time_base = link->src->nb_inputs ?
 -                    link->src->inputs[0]->time_base : AV_TIME_BASE_Q;
 +            switch (link->type) {
 +            case AVMEDIA_TYPE_VIDEO:
 +                if (!link->time_base.num && !link->time_base.den)
 +                    link->time_base = inlink ? inlink->time_base : AV_TIME_BASE_Q;
  
 -            if (link->type == AVMEDIA_TYPE_VIDEO) {
                  if (!link->sample_aspect_ratio.num && !link->sample_aspect_ratio.den)
 -                    link->sample_aspect_ratio = link->src->nb_inputs ?
 -                        link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1};
 +                    link->sample_aspect_ratio = inlink ?
 +                        inlink->sample_aspect_ratio : (AVRational){1,1};
  
-                 if (inlink && !link->frame_rate.num && !link->frame_rate.den)
-                     link->frame_rate = inlink->frame_rate;
 -                if (link->src->nb_inputs) {
 +                if (inlink) {
+                     if (!link->frame_rate.num && !link->frame_rate.den)
 -                        link->frame_rate = link->src->inputs[0]->frame_rate;
++                        link->frame_rate = inlink->frame_rate;
                      if (!link->w)
 -                        link->w = link->src->inputs[0]->w;
 +                        link->w = inlink->w;
                      if (!link->h)
 -                        link->h = link->src->inputs[0]->h;
 +                        link->h = inlink->h;
                  } else if (!link->w || !link->h) {
                      av_log(link->src, AV_LOG_ERROR,
                             "Video source filters must set their output link's "
index 5d4cd6ce12fc950a069f20fd61b0e34675f9dea1,18908583a2b13d891205f65383f44c03475f78e1..7aac3cf93425637eb31c2769177c80480c2f6cfe
@@@ -428,86 -376,17 +428,87 @@@ struct AVFilterLink 
          AVLINK_INIT             ///< complete
      } init_state;
  
 +    /**
 +     * 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
+      * Frame rate of the stream on the link, or 1/0 if unknown or variable;
+      * if left to 0/0, will be automatically copied from the first input
       * of the source filter if it exists.
       *
 -     * Sources should set it to the real constant frame rate.
 +     * Sources should set it to the best estimation of the real frame rate.
+      * If the source frame rate is unknown or variable, set this to 1/0.
       * 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_frame_rate field in AVStream.
       */
      AVRational frame_rate;
 +
 +    /**
 +     * Buffer partially filled with samples to achieve a fixed/minimum size.
 +     */
 +    AVFrame *partial_buf;
 +
 +    /**
 +     * Size of the partial buffer to allocate.
 +     * Must be between min_samples and max_samples.
 +     */
 +    int partial_buf_size;
 +
 +    /**
 +     * Minimum number of samples to filter at once. If filter_frame() is
 +     * called with fewer samples, it will accumulate them in partial_buf.
 +     * This field and the related ones must not be changed after filtering
 +     * has started.
 +     * If 0, all related fields are ignored.
 +     */
 +    int min_samples;
 +
 +    /**
 +     * Maximum number of samples to filter at once. If filter_frame() is
 +     * called with more samples, it will split them.
 +     */
 +    int max_samples;
 +
 +    /**
 +     * True if the link is closed.
 +     * If set, all attempts of start_frame, filter_frame or request_frame
 +     * will fail with AVERROR_EOF, and if necessary the reference will be
 +     * destroyed.
 +     * If request_frame returns AVERROR_EOF, this flag is set on the
 +     * corresponding link.
 +     * It can be set also be set by either the source or the destination
 +     * filter.
 +     */
 +    int closed;
 +
 +    /**
 +     * Number of channels.
 +     */
 +    int channels;
 +
 +    /**
 +     * Link processing flags.
 +     */
 +    unsigned flags;
 +
 +    /**
 +     * Number of past frames sent through the link.
 +     */
 +    int64_t frame_count;
  };
  
  /**