[FFmpeg-cvslog] lavfi/subtitles: use standard options parsing.

Clément Bœsch git at videolan.org
Sun Mar 24 12:33:32 CET 2013


ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Sun Mar 24 09:17:06 2013 +0100| [9e21c89841b9d461efd773753f54c60b157a8ac6] | committer: Clément Bœsch

lavfi/subtitles: use standard options parsing.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9e21c89841b9d461efd773753f54c60b157a8ac6
---

 libavfilter/vf_subtitles.c |   19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/libavfilter/vf_subtitles.c b/libavfilter/vf_subtitles.c
index e5d2e1c..8bca01e 100644
--- a/libavfilter/vf_subtitles.c
+++ b/libavfilter/vf_subtitles.c
@@ -85,17 +85,9 @@ static void ass_log(int ass_level, const char *fmt, va_list args, void *ctx)
     av_log(ctx, level, "\n");
 }
 
-static av_cold int init(AVFilterContext *ctx, const char *args, const AVClass *class)
+static av_cold int init(AVFilterContext *ctx, const char *args)
 {
     AssContext *ass = ctx->priv;
-    static const char *shorthand[] = { "filename", NULL };
-    int ret;
-
-    ass->class = class;
-    av_opt_set_defaults(ass);
-
-    if ((ret = av_opt_set_from_string(ass, args, shorthand, "=", ":")) < 0)
-        return ret;
 
     if (!ass->filename) {
         av_log(ctx, AV_LOG_ERROR, "No filename provided!\n");
@@ -123,7 +115,6 @@ static av_cold void uninit(AVFilterContext *ctx)
 {
     AssContext *ass = ctx->priv;
 
-    av_opt_free(ass);
     if (ass->track)
         ass_free_track(ass->track);
     if (ass->renderer)
@@ -210,6 +201,8 @@ static const AVFilterPad ass_outputs[] = {
     { NULL }
 };
 
+static const char *const shorthand[] = { "filename", NULL };
+
 #if CONFIG_ASS_FILTER
 
 static const AVOption ass_options[] = {
@@ -222,7 +215,7 @@ AVFILTER_DEFINE_CLASS(ass);
 static av_cold int init_ass(AVFilterContext *ctx, const char *args)
 {
     AssContext *ass = ctx->priv;
-    int ret = init(ctx, args, &ass_class);
+    int ret = init(ctx, args);
 
     if (ret < 0)
         return ret;
@@ -247,6 +240,7 @@ AVFilter avfilter_vf_ass = {
     .inputs        = ass_inputs,
     .outputs       = ass_outputs,
     .priv_class    = &ass_class,
+    .shorthand     = shorthand,
 };
 #endif
 
@@ -273,7 +267,7 @@ static av_cold int init_subtitles(AVFilterContext *ctx, const char *args)
     AssContext *ass = ctx->priv;
 
     /* Init libass */
-    ret = init(ctx, args, &subtitles_class);
+    ret = init(ctx, args);
     if (ret < 0)
         return ret;
     ass->track = ass_new_track(ass->library);
@@ -371,5 +365,6 @@ AVFilter avfilter_vf_subtitles = {
     .inputs        = ass_inputs,
     .outputs       = ass_outputs,
     .priv_class    = &subtitles_class,
+    .shorthand     = shorthand,
 };
 #endif



More information about the ffmpeg-cvslog mailing list