| @@ -70,19 +70,20 @@ typedef struct { · 69 unmodified lines |
| 70 | } MovieContext; | 70 | } MovieContext; |
| 71 | | 71 | |
| 72 | #define OFFSET(x) offsetof(MovieContext, x) | 72 | #define OFFSET(x) offsetof(MovieContext, x) |
| 73 | #define F AV_OPT_FLAG_FILTERING_PARAM | 73 | #define FLAGS AV_OPT_FLAG_FILTERING_PARAM |
| 74 | | 74 | |
| 75 | static const AVOption movie_options[]= { | 75 | static const AVOption movie_options[]= { |
| 76 | {"format_name", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX, F }, | 76 | { "filename", NULL, OFFSET(file_name), AV_OPT_TYPE_STRING, .flags = FLAGS }, |
| 77 | {"f", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX, F }, | 77 | { "format_name", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, .flags = FLAGS }, |
| 78 | {"streams", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX, F }, | 78 | { "f", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, .flags = FLAGS }, |
| 79 | {"s", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX, F }, | 79 | { "stream_index", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS }, |
| 80 | {"si", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, F }, | 80 | { "si", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, FLAGS }, |
| 81 | {"stream_index", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, F }, | 81 | { "seek_point", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, { .dbl = 0 }, 0, (INT64_MAX-1) / 1000000, FLAGS }, |
| 82 | {"seek_point", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000, F }, | 82 | { "sp", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, { .dbl = 0 }, 0, (INT64_MAX-1) / 1000000, FLAGS }, |
| 83 | {"sp", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000, F }, | 83 | { "streams", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX, FLAGS }, |
| 84 | {"loop", "set loop count", OFFSET(loop_count), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, F }, | 84 | { "s", "set streams", OFFSET(stream_specs), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MAX, CHAR_MAX, FLAGS }, |
| 85 | {NULL}, | 85 | { "loop", "set loop count", OFFSET(loop_count), AV_OPT_TYPE_INT, {.i64 = 1}, 0, INT_MAX, FLAGS }, |
| | 86 | { NULL }, |
| 86 | }; | 87 | }; |
| 87 | | 88 | |
| 88 | static int movie_config_output_props(AVFilterLink *outlink); | 89 | static int movie_config_output_props(AVFilterLink *outlink); |
| @@ -186,7 +187,7 @@ static int guess_channel_layout(MovieStream *st, int st_index, void *log_ctx) · 97 unmodified lines |
| 186 | return 0; | 187 | return 0; |
| 187 | } | 188 | } |
| 188 | | 189 | |
| 189 | static av_cold int movie_common_init(AVFilterContext *ctx, const char *args, const AVClass *class) | 190 | static av_cold int movie_common_init(AVFilterContext *ctx) |
| 190 | { | 191 | { |
| 191 | MovieContext *movie = ctx->priv; | 192 | MovieContext *movie = ctx->priv; |
| 192 | AVInputFormat *iformat = NULL; | 193 | AVInputFormat *iformat = NULL; |
| @@ -196,22 +197,11 @@ static av_cold int movie_common_init(AVFilterContext *ctx, const char *args, con · 3 unmodified lines |
| 196 | char name[16]; | 197 | char name[16]; |
| 197 | AVStream *st; | 198 | AVStream *st; |
| 198 | | 199 | |
| 199 | movie->class = class; | 200 | if (!*movie->file_name) { |
| 200 | av_opt_set_defaults(movie); | | |
| 201 | | | |
| 202 | if (args) { | | |
| 203 | movie->file_name = av_get_token(&args, ":"); | | |
| 204 | if (!movie->file_name) | | |
| 205 | return AVERROR(ENOMEM); | | |
| 206 | } | | |
| 207 | if (!args || !*movie->file_name) { | | |
| 208 | av_log(ctx, AV_LOG_ERROR, "No filename provided!\n"); | 201 | av_log(ctx, AV_LOG_ERROR, "No filename provided!\n"); |
| 209 | return AVERROR(EINVAL); | 202 | return AVERROR(EINVAL); |
| 210 | } | 203 | } |
| 211 | | 204 | |
| 212 | if (*args++ == ':' && (ret = av_set_options_string(movie, args, "=", ":")) < 0) | | |
| 213 | return ret; | | |
| 214 | | | |
| 215 | movie->seek_point = movie->seek_point_d * 1000000 + 0.5; | 205 | movie->seek_point = movie->seek_point_d * 1000000 + 0.5; |
| 216 | | 206 | |
| 217 | stream_specs = movie->stream_specs; | 207 | stream_specs = movie->stream_specs; |
| @@ -332,7 +322,6 @@ static av_cold void movie_uninit(AVFilterContext *ctx) · 114 unmodified lines |
| 332 | if (movie->st[i].st) | 322 | if (movie->st[i].st) |
| 333 | avcodec_close(movie->st[i].st->codec); | 323 | avcodec_close(movie->st[i].st->codec); |
| 334 | } | 324 | } |
| 335 | av_opt_free(movie); | | |
| 336 | av_freep(&movie->file_name); | 325 | av_freep(&movie->file_name); |
| 337 | av_freep(&movie->st); | 326 | av_freep(&movie->st); |
| 338 | av_freep(&movie->out_index); | 327 | av_freep(&movie->out_index); |
| @@ -576,20 +565,20 @@ AVFILTER_DEFINE_CLASS(movie); · 237 unmodified lines |
| 576 | | 565 | |
| 577 | static av_cold int movie_init(AVFilterContext *ctx, const char *args) | 566 | static av_cold int movie_init(AVFilterContext *ctx, const char *args) |
| 578 | { | 567 | { |
| 579 | return movie_common_init(ctx, args, &movie_class); | 568 | return movie_common_init(ctx); |
| 580 | } | 569 | } |
| 581 | | 570 | |
| 582 | AVFilter avfilter_avsrc_movie = { | 571 | AVFilter avfilter_avsrc_movie = { |
| 583 | .name = "movie", | 572 | .name = "movie", |
| 584 | .description = NULL_IF_CONFIG_SMALL("Read from a movie source."), | 573 | .description = NULL_IF_CONFIG_SMALL("Read from a movie source."), |
| 585 | .priv_size = sizeof(MovieContext), | 574 | .priv_size = sizeof(MovieContext), |
| | 575 | .priv_class = &movie_class, |
| 586 | .init = movie_init, | 576 | .init = movie_init, |
| 587 | .uninit = movie_uninit, | 577 | .uninit = movie_uninit, |
| 588 | .query_formats = movie_query_formats, | 578 | .query_formats = movie_query_formats, |
| 589 | | 579 | |
| 590 | .inputs = NULL, | 580 | .inputs = NULL, |
| 591 | .outputs = NULL, | 581 | .outputs = NULL, |
| 592 | .priv_class = &movie_class, | | |
| 593 | }; | 582 | }; |
| 594 | | 583 | |
| 595 | #endif /* CONFIG_MOVIE_FILTER */ | 584 | #endif /* CONFIG_MOVIE_FILTER */ |
| @@ -601,7 +590,7 @@ AVFILTER_DEFINE_CLASS(amovie); · 5 unmodified lines |
| 601 | | 590 | |
| 602 | static av_cold int amovie_init(AVFilterContext *ctx, const char *args) | 591 | static av_cold int amovie_init(AVFilterContext *ctx, const char *args) |
| 603 | { | 592 | { |
| 604 | return movie_common_init(ctx, args, &amovie_class); | 593 | return movie_common_init(ctx); |
| 605 | } | 594 | } |
| 606 | | 595 | |
| 607 | AVFilter avfilter_avsrc_amovie = { | 596 | AVFilter avfilter_avsrc_amovie = { |