summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2018-04-19 17:42:14 +0200
committerwm4 <wm4@nowhere>2018-04-19 23:22:48 +0200
commitff24285eb15676dc7519b858be01a1def155e847 (patch)
treeda962345d8d33108c0b096c3aaeec6cbc41fe25c /video
parente7e06a47a0b5626c3abe81f3627d10ed58d92d3b (diff)
downloadmpv-ff24285eb15676dc7519b858be01a1def155e847.tar.bz2
mpv-ff24285eb15676dc7519b858be01a1def155e847.tar.xz
video: pass through container fps to filters
This means vf_vapoursynth doesn't need a hack to work around the filter code, and libavfilter filters now actually get the frame_rate field on input pads set. The libavfilter doxygen says the frame_rate field is only to be set if the frame rate is known to be constant, and uses the word "must" (which probably means they really mean it?) - but ffmpeg.c sets the field to mere guesses anyway, and it looks like this normally won't lead to problems.
Diffstat (limited to 'video')
-rw-r--r--video/filter/vf_vapoursynth.c10
-rw-r--r--video/mp_image.c1
-rw-r--r--video/mp_image.h2
3 files changed, 7 insertions, 6 deletions
diff --git a/video/filter/vf_vapoursynth.c b/video/filter/vf_vapoursynth.c
index 5077f4cf19..d9a222db83 100644
--- a/video/filter/vf_vapoursynth.c
+++ b/video/filter/vf_vapoursynth.c
@@ -103,7 +103,7 @@ static const struct mp_image dummy_img;
static const struct mp_image dummy_img_eof;
static void destroy_vs(struct priv *p);
-static int reinit_vs(struct priv *p);
+static int reinit_vs(struct priv *p, struct mp_image *input);
struct script_driver {
int (*init)(struct priv *p); // first time init
@@ -368,7 +368,7 @@ static void vf_vapoursynth_process(struct mp_filter *f)
if (p->out_node)
destroy_vs(p);
p->fmt_in = mpi->params;
- if (reinit_vs(p) < 0) {
+ if (reinit_vs(p, mpi) < 0) {
MP_ERR(p, "could not init VS\n");
mp_frame_unref(&frame);
return;
@@ -617,7 +617,7 @@ static void destroy_vs(struct priv *p)
MP_DBG(p, "uninitialized.\n");
}
-static int reinit_vs(struct priv *p)
+static int reinit_vs(struct priv *p, struct mp_image *input)
{
VSMap *vars = NULL, *in = NULL, *out = NULL;
int res = -1;
@@ -665,11 +665,9 @@ static int reinit_vs(struct priv *p)
p->vsapi->propSetInt(vars, "video_in_dh", d_h, 0);
struct mp_stream_info *info = mp_filter_find_stream_info(p->f);
- double container_fps = 0;
+ double container_fps = input->nominal_fps;
double display_fps = 0;
if (info) {
- if (info->get_container_fps)
- container_fps = info->get_container_fps(info);
if (info->get_display_fps)
display_fps = info->get_display_fps(info);
}
diff --git a/video/mp_image.c b/video/mp_image.c
index 6ab3b87150..8aa3aa025c 100644
--- a/video/mp_image.c
+++ b/video/mp_image.c
@@ -508,6 +508,7 @@ void mp_image_copy_attributes(struct mp_image *dst, struct mp_image *src)
dst->params.color = src->params.color;
dst->params.chroma_location = src->params.chroma_location;
dst->params.spherical = src->params.spherical;
+ dst->nominal_fps = src->nominal_fps;
// ensure colorspace consistency
if (mp_image_params_get_forced_csp(&dst->params) !=
mp_image_params_get_forced_csp(&src->params))
diff --git a/video/mp_image.h b/video/mp_image.h
index 88e261306f..70e9b9e138 100644
--- a/video/mp_image.h
+++ b/video/mp_image.h
@@ -105,6 +105,8 @@ typedef struct mp_image {
double pts;
/* only after decoder */
double dts, pkt_duration;
+ /* container reported FPS; can be incorrect, or 0 if unknown */
+ double nominal_fps;
/* for private use */
void* priv;