Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-04-10 18:56:33 +0400
committerMichael Niedermayer <michaelni@gmx.at>2013-04-10 18:56:33 +0400
commit200e04c70f9a77fd117d4ebb9d0fad9656514979 (patch)
tree6d13479cc172497e295341fe05ce869fb51a9c19 /libavfilter/vf_crop.c
parenteb6d58d23c557fe53b6b26f9e0b2350c1046b56d (diff)
parentfba0156af77b11ec99edf4ee8f511b7aaa6b1891 (diff)
Merge commit 'fba0156af77b11ec99edf4ee8f511b7aaa6b1891'
* commit 'fba0156af77b11ec99edf4ee8f511b7aaa6b1891': vf_crop: switch to an AVOptions-based system. Conflicts: doc/filters.texi libavfilter/vf_crop.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_crop.c')
-rw-r--r--libavfilter/vf_crop.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c
index f99d1a7ce9..35bb3e699e 100644
--- a/libavfilter/vf_crop.c
+++ b/libavfilter/vf_crop.c
@@ -91,30 +91,6 @@ typedef struct {
double var_values[VAR_VARS_NB];
} CropContext;
-#define OFFSET(x) offsetof(CropContext, x)
-#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
-
-static const AVOption crop_options[] = {
- { "x", "set the x crop area expression", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str = "(in_w-out_w)/2"}, CHAR_MIN, CHAR_MAX, FLAGS },
- { "y", "set the y crop area expression", OFFSET(y_expr), AV_OPT_TYPE_STRING, {.str = "(in_h-out_h)/2"}, CHAR_MIN, CHAR_MAX, FLAGS },
- { "out_w", "set the width crop area expression", OFFSET(w_expr), AV_OPT_TYPE_STRING, {.str = "iw"}, CHAR_MIN, CHAR_MAX, FLAGS },
- { "w", "set the width crop area expression", OFFSET(w_expr), AV_OPT_TYPE_STRING, {.str = "iw"}, CHAR_MIN, CHAR_MAX, FLAGS },
- { "out_h", "set the height crop area expression", OFFSET(h_expr), AV_OPT_TYPE_STRING, {.str = "ih"}, CHAR_MIN, CHAR_MAX, FLAGS },
- { "h", "set the height crop area expression", OFFSET(h_expr), AV_OPT_TYPE_STRING, {.str = "ih"}, CHAR_MIN, CHAR_MAX, FLAGS },
- { "keep_aspect", "keep aspect ratio", OFFSET(keep_aspect), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS },
- {NULL}
-};
-
-AVFILTER_DEFINE_CLASS(crop);
-
-static av_cold void uninit(AVFilterContext *ctx)
-{
- CropContext *crop = ctx->priv;
-
- av_expr_free(crop->x_pexpr); crop->x_pexpr = NULL;
- av_expr_free(crop->y_pexpr); crop->y_pexpr = NULL;
-}
-
static int query_formats(AVFilterContext *ctx)
{
static const enum AVPixelFormat pix_fmts[] = {
@@ -148,6 +124,14 @@ static int query_formats(AVFilterContext *ctx)
return 0;
}
+static av_cold void uninit(AVFilterContext *ctx)
+{
+ CropContext *crop = ctx->priv;
+
+ av_expr_free(crop->x_pexpr); crop->x_pexpr = NULL;
+ av_expr_free(crop->y_pexpr); crop->y_pexpr = NULL;
+}
+
static inline int normalize_double(int *n, double d)
{
int ret = 0;
@@ -316,6 +300,22 @@ static int filter_frame(AVFilterLink *link, AVFrame *frame)
return ff_filter_frame(link->dst->outputs[0], frame);
}
+#define OFFSET(x) offsetof(CropContext, x)
+#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
+
+static const AVOption crop_options[] = {
+ { "out_w", "set the width crop area expression", OFFSET(w_expr), AV_OPT_TYPE_STRING, {.str = "iw"}, CHAR_MIN, CHAR_MAX, FLAGS },
+ { "w", "set the width crop area expression", OFFSET(w_expr), AV_OPT_TYPE_STRING, {.str = "iw"}, CHAR_MIN, CHAR_MAX, FLAGS },
+ { "out_h", "set the height crop area expression", OFFSET(h_expr), AV_OPT_TYPE_STRING, {.str = "ih"}, CHAR_MIN, CHAR_MAX, FLAGS },
+ { "h", "set the height crop area expression", OFFSET(h_expr), AV_OPT_TYPE_STRING, {.str = "ih"}, CHAR_MIN, CHAR_MAX, FLAGS },
+ { "x", "set the x crop area expression", OFFSET(x_expr), AV_OPT_TYPE_STRING, {.str = "(in_w-out_w)/2"}, CHAR_MIN, CHAR_MAX, FLAGS },
+ { "y", "set the y crop area expression", OFFSET(y_expr), AV_OPT_TYPE_STRING, {.str = "(in_h-out_h)/2"}, CHAR_MIN, CHAR_MAX, FLAGS },
+ { "keep_aspect", "keep aspect ratio", OFFSET(keep_aspect), AV_OPT_TYPE_INT, {.i64=0}, 0, 1, FLAGS },
+ {NULL}
+};
+
+AVFILTER_DEFINE_CLASS(crop);
+
static const AVFilterPad avfilter_vf_crop_inputs[] = {
{
.name = "default",
@@ -336,13 +336,12 @@ static const AVFilterPad avfilter_vf_crop_outputs[] = {
{ NULL }
};
-static const char *const shorthand[] = { "w", "h", "x", "y", "keep_aspect", NULL };
-
AVFilter avfilter_vf_crop = {
.name = "crop",
.description = NULL_IF_CONFIG_SMALL("Crop the input video to width:height:x:y."),
.priv_size = sizeof(CropContext),
+ .priv_class = &crop_class,
.query_formats = query_formats,
.uninit = uninit,
@@ -350,5 +349,4 @@ AVFilter avfilter_vf_crop = {
.inputs = avfilter_vf_crop_inputs,
.outputs = avfilter_vf_crop_outputs,
.priv_class = &crop_class,
- .shorthand = shorthand,
};