Revision 910b5b82

View differences:

libavfilter/avfilter.c
194 194
                link->time_base = link->src && link->src->input_count ?
195 195
                    link->src->inputs[0]->time_base : AV_TIME_BASE_Q;
196 196

  
197
            if (link->sample_aspect_ratio.num == 0 && link->sample_aspect_ratio.den == 0)
198
                link->sample_aspect_ratio = link->src->input_count ?
199
                    link->src->inputs[0]->sample_aspect_ratio : (AVRational){1,1};
200

  
197 201
            if ((config_link = link->dstpad->config_props))
198 202
                if ((ret = config_link(link)) < 0)
199 203
                    return ret;
libavfilter/avfilter.h
27 27
#include "libavcore/samplefmt.h"
28 28

  
29 29
#define LIBAVFILTER_VERSION_MAJOR  1
30
#define LIBAVFILTER_VERSION_MINOR 75
30
#define LIBAVFILTER_VERSION_MINOR 76
31 31
#define LIBAVFILTER_VERSION_MICRO  0
32 32

  
33 33
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
......
580 580

  
581 581
    enum AVMediaType type;      ///< filter media type
582 582

  
583
    /* These two parameters apply only to video */
583
    /* These parameters apply only to video */
584 584
    int w;                      ///< agreed upon image width
585 585
    int h;                      ///< agreed upon image height
586
    AVRational sample_aspect_ratio; ///< agreed upon sample aspect ratio
586 587
    /* These two parameters apply only to audio */
587 588
    int64_t channel_layout;     ///< channel layout of current buffer (see libavcore/audioconvert.h)
588 589
    int64_t sample_rate;        ///< samples per second
libavfilter/vf_aspect.c
82 82

  
83 83
    av_log(inlink->dst, AV_LOG_INFO, "w:%d h:%d -> dar:%d/%d par:%d/%d\n",
84 84
           inlink->w, inlink->h, dar.num, dar.den, aspect->aspect.num, aspect->aspect.den);
85

  
86
    inlink->sample_aspect_ratio = aspect->aspect;
87

  
85 88
    return 0;
86 89
}
87 90

  
......
108 111
#endif /* CONFIG_SETDAR_FILTER */
109 112

  
110 113
#if CONFIG_SETSAR_FILTER
114
/* for setdar filter, convert from frame aspect ratio to pixel aspect ratio */
115
static int setsar_config_props(AVFilterLink *inlink)
116
{
117
    AspectContext *aspect = inlink->dst->priv;
118

  
119
    inlink->sample_aspect_ratio = aspect->aspect;
120

  
121
    return 0;
122
}
123

  
111 124
AVFilter avfilter_vf_setsar = {
112 125
    .name      = "setsar",
113 126
    .description = NULL_IF_CONFIG_SMALL("Set the pixel sample aspect ratio."),
......
118 131

  
119 132
    .inputs    = (AVFilterPad[]) {{ .name             = "default",
120 133
                                    .type             = AVMEDIA_TYPE_VIDEO,
134
                                    .config_props     = setsar_config_props,
121 135
                                    .get_video_buffer = avfilter_null_get_video_buffer,
122 136
                                    .start_frame      = start_frame,
123 137
                                    .end_frame        = avfilter_null_end_frame },
libavfilter/vf_transpose.c
102 102
    outlink->w = inlink->h;
103 103
    outlink->h = inlink->w;
104 104

  
105
    if (inlink->sample_aspect_ratio.num){
106
        outlink->sample_aspect_ratio = av_div_q((AVRational){1,1}, inlink->sample_aspect_ratio);
107
    } else
108
        outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
109

  
105 110
    av_log(ctx, AV_LOG_INFO, "w:%d h:%d dir:%d -> w:%d h:%d rotation:%s vflip:%d\n",
106 111
           inlink->w, inlink->h, trans->dir, outlink->w, outlink->h,
107 112
           trans->dir == 1 || trans->dir == 3 ? "clockwise" : "counterclockwise",

Also available in: Unified diff