57
57
#define OFFSET(x) offsetof(MovieContext, x)
59
59
static const AVOption movie_options[]= {
60
{"format_name", "set format name", OFFSET(format_name), FF_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX },
61
{"f", "set format name", OFFSET(format_name), FF_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX },
62
{"stream_index", "set stream index", OFFSET(stream_index), FF_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX },
63
{"si", "set stream index", OFFSET(stream_index), FF_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX },
64
{"seek_point", "set seekpoint (seconds)", OFFSET(seek_point_d), FF_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000 },
65
{"sp", "set seekpoint (seconds)", OFFSET(seek_point_d), FF_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000 },
60
{"format_name", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX },
61
{"f", "set format name", OFFSET(format_name), AV_OPT_TYPE_STRING, {.str = 0}, CHAR_MIN, CHAR_MAX },
62
{"stream_index", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX },
63
{"si", "set stream index", OFFSET(stream_index), AV_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX },
64
{"seek_point", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000 },
65
{"sp", "set seekpoint (seconds)", OFFSET(seek_point_d), AV_OPT_TYPE_DOUBLE, {.dbl = 0}, 0, (INT64_MAX-1) / 1000000 },
96
96
"Failed to avformat_open_input '%s'\n", movie->file_name);
99
if ((ret = av_find_stream_info(movie->format_ctx)) < 0)
99
if ((ret = avformat_find_stream_info(movie->format_ctx, NULL)) < 0)
100
100
av_log(ctx, AV_LOG_WARNING, "Failed to find stream info\n");
102
102
// if seeking requested, we execute it
240
240
av_image_copy(movie->picref->data, movie->picref->linesize,
241
241
movie->frame->data, movie->frame->linesize,
242
242
movie->picref->format, outlink->w, outlink->h);
243
avfilter_copy_frame_props(movie->picref, movie->frame);
244
245
/* FIXME: use a PTS correction mechanism as that in
245
246
* ffplay.c when some API will be available for that */
248
249
movie->frame->pkt_dts : movie->frame->pkt_pts;
250
251
movie->picref->pos = movie->frame->reordered_opaque;
251
movie->picref->video->pixel_aspect = st->sample_aspect_ratio.num ?
252
st->sample_aspect_ratio : movie->codec_ctx->sample_aspect_ratio;
253
movie->picref->video->interlaced = movie->frame->interlaced_frame;
254
movie->picref->video->top_field_first = movie->frame->top_field_first;
255
movie->picref->video->key_frame = movie->frame->key_frame;
256
movie->picref->video->pict_type = movie->frame->pict_type;
252
if (!movie->frame->sample_aspect_ratio.num)
253
movie->picref->video->pixel_aspect = st->sample_aspect_ratio;
257
254
av_dlog(outlink->src,
258
255
"movie_get_frame(): file:'%s' pts:%"PRId64" time:%lf pos:%"PRId64" aspect:%d/%d\n",
259
256
movie->file_name, movie->picref->pts,