summaryrefslogtreecommitdiff
path: root/libavfilter
diff options
context:
space:
mode:
authorStefano Sabatini <stefasab@gmail.com>2012-10-15 10:06:52 +0200
committerStefano Sabatini <stefasab@gmail.com>2012-10-15 22:40:08 +0200
commitfaa1cb50ed7d2258932475ff571b7662f0089514 (patch)
tree24a27911afc56069d552e7636115de8b996e1800 /libavfilter
parent22c5cc239c253a5940346915dc9aebf171b4ac48 (diff)
lavfi/ass: extend syntax for ass filter
Make the filter accept named options for the first argument, and update documentation accordingly.
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/version.h2
-rw-r--r--libavfilter/vf_ass.c15
2 files changed, 9 insertions, 8 deletions
diff --git a/libavfilter/version.h b/libavfilter/version.h
index 212010beff..1f9320c5e5 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -30,7 +30,7 @@
#define LIBAVFILTER_VERSION_MAJOR 3
#define LIBAVFILTER_VERSION_MINOR 19
-#define LIBAVFILTER_VERSION_MICRO 102
+#define LIBAVFILTER_VERSION_MICRO 103
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
diff --git a/libavfilter/vf_ass.c b/libavfilter/vf_ass.c
index 6b206317e6..dab4f68868 100644
--- a/libavfilter/vf_ass.c
+++ b/libavfilter/vf_ass.c
@@ -54,6 +54,8 @@ typedef struct {
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static const AVOption ass_options[] = {
+ {"filename", "set the filename of the ASS file to read", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS },
+ {"f", "set the filename of the ASS file to read", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS },
{"original_size", "set the size of the original video (used to scale fonts)", OFFSET(original_w), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, CHAR_MIN, CHAR_MAX, FLAGS },
{NULL},
};
@@ -83,21 +85,20 @@ static void ass_log(int ass_level, const char *fmt, va_list args, void *ctx)
static av_cold int init(AVFilterContext *ctx, const char *args)
{
AssContext *ass = ctx->priv;
+ static const char *shorthand[] = { "filename", NULL };
int ret;
ass->class = &ass_class;
av_opt_set_defaults(ass);
- if (args)
- ass->filename = av_get_token(&args, ":");
- if (!ass->filename || !*ass->filename) {
+ 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");
return AVERROR(EINVAL);
}
- if (*args++ == ':' && (ret = av_set_options_string(ass, args, "=", ":")) < 0)
- return ret;
-
ass->library = ass_library_init();
if (!ass->library) {
av_log(ctx, AV_LOG_ERROR, "Could not initialize libass.\n");
@@ -127,7 +128,7 @@ static av_cold void uninit(AVFilterContext *ctx)
{
AssContext *ass = ctx->priv;
- av_freep(&ass->filename);
+ av_opt_free(ass);
if (ass->track)
ass_free_track(ass->track);
if (ass->renderer)