[FFmpeg-devel] [PATCH 05/14] lavfi/vf_crop: use standard options parsing.

Nicolas George nicolas.george at normalesup.org
Sat Mar 16 21:39:25 CET 2013


Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
---
 libavfilter/vf_crop.c |   15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c
index 17487a2..866b28e 100644
--- a/libavfilter/vf_crop.c
+++ b/libavfilter/vf_crop.c
@@ -107,17 +107,6 @@ static const AVOption crop_options[] = {
 
 AVFILTER_DEFINE_CLASS(crop);
 
-static av_cold int init(AVFilterContext *ctx, const char *args)
-{
-    CropContext *crop = ctx->priv;
-    static const char *shorthand[] = { "w", "h", "x", "y", "keep_aspect", NULL };
-
-    crop->class = &crop_class;
-    av_opt_set_defaults(crop);
-
-    return av_opt_set_from_string(crop, args, shorthand, "=", ":");
-}
-
 static av_cold void uninit(AVFilterContext *ctx)
 {
     CropContext *crop = ctx->priv;
@@ -348,6 +337,8 @@ 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."),
@@ -355,10 +346,10 @@ AVFilter avfilter_vf_crop = {
     .priv_size = sizeof(CropContext),
 
     .query_formats = query_formats,
-    .init          = init,
     .uninit        = uninit,
 
     .inputs    = avfilter_vf_crop_inputs,
     .outputs   = avfilter_vf_crop_outputs,
     .priv_class = &crop_class,
+    .shorthand = shorthand,
 };
-- 
1.7.10.4



More information about the ffmpeg-devel mailing list