static const AVOption movie_options[]= {
{"format_name", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX },
{"f", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX },
-{"stream_index", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX },
-{"si", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX },
+{"stream_index", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX },
+{"si", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX },
{"seek_point", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000 },
{"sp", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000 },
{NULL},
movie->w = movie->codec_ctx->width;
movie->h = movie->codec_ctx->height;
- av_log(ctx, AV_LOG_INFO, "seek_point:%"PRIi64" format_name:%s file_name:%s stream_index:%d\n",
+ av_log(ctx, AV_LOG_VERBOSE, "seek_point:%"PRIi64" format_name:%s file_name:%s stream_index:%d\n",
movie->seek_point, movie->format_name, movie->file_name,
movie->stream_index);
return 0;
}
-static av_cold int init(AVFilterContext *ctx, const char *args, void *opaque)
+static av_cold int init(AVFilterContext *ctx, const char *args)
{
MovieContext *movie = ctx->priv;
int ret;
if (movie->format_ctx)
avformat_close_input(&movie->format_ctx);
avfilter_unref_buffer(movie->picref);
- av_freep(&movie->frame);
+ avcodec_free_frame(&movie->frame);
}
static int query_formats(AVFilterContext *ctx)
{
MovieContext *movie = ctx->priv;
- enum PixelFormat pix_fmts[] = { movie->codec_ctx->pix_fmt, PIX_FMT_NONE };
+ enum AVPixelFormat pix_fmts[] = { movie->codec_ctx->pix_fmt, AV_PIX_FMT_NONE };
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
return ret;
outpicref = avfilter_ref_buffer(movie->picref, ~0);
- ff_start_frame(outlink, outpicref);
- ff_draw_slice(outlink, 0, outlink->h, 1);
- ff_end_frame(outlink);
- avfilter_unref_buffer(movie->picref);
- movie->picref = NULL;
+ if (!outpicref) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
- return 0;
+ ret = ff_start_frame(outlink, outpicref);
+ if (ret < 0)
+ goto fail;
+
+ ret = ff_draw_slice(outlink, 0, outlink->h, 1);
+ if (ret < 0)
+ goto fail;
+
+ ret = ff_end_frame(outlink);
+fail:
+ avfilter_unref_bufferp(&movie->picref);
+
+ return ret;
}
+static const AVFilterPad avfilter_vsrc_movie_outputs[] = {
+ {
+ .name = "default",
+ .type = AVMEDIA_TYPE_VIDEO,
+ .request_frame = request_frame,
+ .config_props = config_output_props,
+ },
+ { NULL }
+};
+
AVFilter avfilter_vsrc_movie = {
.name = "movie",
.description = NULL_IF_CONFIG_SMALL("Read from a movie source."),
.uninit = uninit,
.query_formats = query_formats,
- .inputs = (AVFilterPad[]) {{ .name = NULL }},
- .outputs = (AVFilterPad[]) {{ .name = "default",
- .type = AVMEDIA_TYPE_VIDEO,
- .request_frame = request_frame,
- .config_props = config_output_props, },
- { .name = NULL}},
+ .inputs = NULL,
+ .outputs = avfilter_vsrc_movie_outputs,
};