mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 02:01:12 +00:00
vadeinterlace: Fixate interlace-mode and framerate accordingly.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1024>
This commit is contained in:
parent
10e5db047a
commit
bf1b03e5cb
1 changed files with 38 additions and 25 deletions
|
@ -568,11 +568,10 @@ gst_va_deinterlace_fixate_caps (GstBaseTransform * trans,
|
||||||
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
|
||||||
{
|
{
|
||||||
GstVaDeinterlace *self = GST_VA_DEINTERLACE (trans);
|
GstVaDeinterlace *self = GST_VA_DEINTERLACE (trans);
|
||||||
GstCaps *tmp;
|
GstCapsFeatures *out_f;
|
||||||
GstStructure *s;
|
GstStructure *in_s, *out_s;
|
||||||
GstVideoInfo info;
|
|
||||||
gint fps_n, fps_d;
|
gint fps_n, fps_d;
|
||||||
const gchar *interlace_mode;
|
const gchar *in_interlace_mode, *out_interlace_mode;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self,
|
GST_DEBUG_OBJECT (self,
|
||||||
"trying to fixate othercaps %" GST_PTR_FORMAT " based on caps %"
|
"trying to fixate othercaps %" GST_PTR_FORMAT " based on caps %"
|
||||||
|
@ -586,34 +585,48 @@ gst_va_deinterlace_fixate_caps (GstBaseTransform * trans,
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp = gst_caps_copy (caps);
|
in_s = gst_caps_get_structure (caps, 0);
|
||||||
tmp = gst_caps_fixate (tmp);
|
in_interlace_mode = gst_structure_get_string (in_s, "interlace-mode");
|
||||||
|
|
||||||
if (!gst_video_info_from_caps (&info, tmp)) {
|
out_s = gst_caps_get_structure (othercaps, 0);
|
||||||
GST_WARNING_OBJECT (self, "Invalid caps %" GST_PTR_FORMAT, caps);
|
|
||||||
gst_caps_unref (tmp);
|
if (g_strcmp0 ("progressive", in_interlace_mode) == 0) {
|
||||||
|
/* Just forward interlace-mode=progressive and framerate
|
||||||
|
* By this way, basetransform will enable passthrough for non-interlaced
|
||||||
|
* stream */
|
||||||
|
const GValue *framerate = gst_structure_get_value (in_s, "framerate");
|
||||||
|
gst_structure_set_value (out_s, "framerate", framerate);
|
||||||
|
gst_structure_set (out_s, "interlace-mode", G_TYPE_STRING, "progressive",
|
||||||
|
NULL);
|
||||||
|
|
||||||
othercaps = gst_caps_fixate (othercaps);
|
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
s = gst_caps_get_structure (tmp, 0);
|
out_f = gst_caps_get_features (othercaps, 0);
|
||||||
if (gst_structure_get_fraction (s, "framerate", &fps_n, &fps_d)) {
|
out_interlace_mode = gst_structure_get_string (out_s, "interlace-mode");
|
||||||
fps_n *= 2;
|
|
||||||
gst_caps_set_simple (othercaps,
|
|
||||||
"framerate", GST_TYPE_FRACTION, fps_n, fps_d, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
interlace_mode = gst_structure_get_string (s, "interlace-mode");
|
if ((!out_interlace_mode
|
||||||
if (g_strcmp0 ("progressive", interlace_mode) == 0) {
|
|| (g_strcmp0 ("progressive", out_interlace_mode) == 0))
|
||||||
/* Just forward interlace-mode=progressive.
|
&& (gst_caps_features_contains (out_f, GST_CAPS_FEATURE_MEMORY_VA)
|
||||||
* By this way, basetransform will enable passthrough for non-interlaced
|
|| gst_caps_features_contains (out_f, GST_CAPS_FEATURE_MEMORY_DMABUF)
|
||||||
* stream*/
|
|| gst_caps_features_contains (out_f,
|
||||||
gst_caps_set_simple (othercaps,
|
GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY))) {
|
||||||
"interlace-mode", G_TYPE_STRING, "progressive", NULL);
|
gst_structure_set (out_s, "interlace-mode", G_TYPE_STRING, "progressive",
|
||||||
}
|
NULL);
|
||||||
|
|
||||||
gst_caps_unref (tmp);
|
if (gst_structure_get_fraction (in_s, "framerate", &fps_n, &fps_d)) {
|
||||||
|
fps_n *= 2;
|
||||||
|
gst_structure_set (out_s, "framerate", GST_TYPE_FRACTION, fps_n, fps_d,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* if caps features aren't supported, just forward interlace-mode
|
||||||
|
* and framerate */
|
||||||
|
const GValue *framerate = gst_structure_get_value (in_s, "framerate");
|
||||||
|
gst_structure_set_value (out_s, "framerate", framerate);
|
||||||
|
gst_structure_set (out_s, "interlace-mode", G_TYPE_STRING,
|
||||||
|
in_interlace_mode, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
bail:
|
bail:
|
||||||
GST_DEBUG_OBJECT (self, "fixated othercaps to %" GST_PTR_FORMAT, othercaps);
|
GST_DEBUG_OBJECT (self, "fixated othercaps to %" GST_PTR_FORMAT, othercaps);
|
||||||
|
|
Loading…
Reference in a new issue