summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-04-28 23:41:20 +0200
committerwm4 <wm4@nowhere>2014-04-28 23:44:57 +0200
commit48587e88e0e55790d7e0bc6b3e443dfc93a37fa0 (patch)
tree99392bb56769c454ae0fe69c8cbd96a6e808b062 /video
parent6b0b8368a42a15f1ac30b6a688aade0e805b532f (diff)
downloadmpv-48587e88e0e55790d7e0bc6b3e443dfc93a37fa0.tar.bz2
mpv-48587e88e0e55790d7e0bc6b3e443dfc93a37fa0.tar.xz
vf_vapoursynth: add more VS frame properties
We only support them for input. The frame properties of output frames are ignored (except frame durations). Properties not set for now: _ChromaLocation, _Field, _FieldBased
Diffstat (limited to 'video')
-rw-r--r--video/filter/vf_vapoursynth.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/video/filter/vf_vapoursynth.c b/video/filter/vf_vapoursynth.c
index 9a86e4c4f1..4b9b879c9b 100644
--- a/video/filter/vf_vapoursynth.c
+++ b/video/filter/vf_vapoursynth.c
@@ -106,6 +106,31 @@ static int mp_from_vs(VSPresetFormat vs)
return pfNone;
}
+static void copy_mp_to_vs_frame_props(struct vf_priv_s *p, VSMap *map,
+ struct mp_image *img)
+{
+ struct mp_image_params *params = &img->params;
+ if (params->d_w > 0 && params->d_h > 0) {
+ p->vsapi->propSetInt(map, "_SARNum", params->d_w, 0);
+ p->vsapi->propSetInt(map, "_SARDen", params->d_h, 0);
+ }
+ if (params->colorlevels) {
+ p->vsapi->propSetInt(map, "_ColorRange",
+ params->colorlevels == MP_CSP_LEVELS_TV, 0);
+ }
+ // The docs explicitly say it uses libavcodec values.
+ p->vsapi->propSetInt(map, "_ColorSpace",
+ mp_csp_to_avcol_spc(params->colorspace), 0);
+ char pict_type = 0;
+ switch (img->pict_type) {
+ case 1: pict_type = 'I'; break;
+ case 2: pict_type = 'P'; break;
+ case 3: pict_type = 'B'; break;
+ }
+ if (pict_type)
+ p->vsapi->propSetData(map, "_PictType", &pict_type, 1, 0);
+}
+
static struct mp_image map_vs_frame(struct vf_priv_s *p, const VSFrameRef *ref,
bool w)
{
@@ -302,6 +327,7 @@ static const VSFrameRef *VS_CC infiltGetFrame(int frameno, int activationReason,
int dur = img->pts * res + 0.5;
p->vsapi->propSetInt(map, "_DurationNum", dur, 0);
p->vsapi->propSetInt(map, "_DurationDen", res, 0);
+ copy_mp_to_vs_frame_props(p, map, img);
}
break;
}