videolevels: fixes to caps handling
This commit is contained in:
parent
38bf83dbe9
commit
53c2a38d81
@ -353,28 +353,6 @@ gst_videolevels_transform_caps (GstBaseTransform * base,
|
|||||||
|
|
||||||
GST_DEBUG_OBJECT (caps, "transforming caps (from)");
|
GST_DEBUG_OBJECT (caps, "transforming caps (from)");
|
||||||
|
|
||||||
/* copy static pad caps to get bpp/depth/endianess */
|
|
||||||
//if (direction == GST_PAD_SINK) {
|
|
||||||
// static_caps = gst_static_pad_template_get_caps (&gst_videolevels_sink_template);
|
|
||||||
//}
|
|
||||||
//else {
|
|
||||||
// static_caps = gst_static_pad_template_get_caps (&gst_videolevels_src_template);
|
|
||||||
//}
|
|
||||||
//structure = gst_caps_get_structure (static_caps, 0);
|
|
||||||
//gst_structure_get_value()
|
|
||||||
//newcaps = gst_caps_copy (caps);
|
|
||||||
//gst_caps_unref (static_caps);
|
|
||||||
|
|
||||||
///* get width and height from proposed caps */
|
|
||||||
//structure = gst_caps_get_structure (caps, 0);
|
|
||||||
//width = gst_structure_get_value (structure, "width");
|
|
||||||
//height = gst_structure_get_value (structure, "height");
|
|
||||||
//
|
|
||||||
///* set width and height to new caps */
|
|
||||||
//structure = gst_caps_get_structure (newcaps, 0);
|
|
||||||
//gst_structure_set_value (structure, "width", width);
|
|
||||||
//gst_structure_set_value (structure, "height", height);
|
|
||||||
|
|
||||||
newcaps = gst_caps_copy (caps);
|
newcaps = gst_caps_copy (caps);
|
||||||
|
|
||||||
/* finish settings caps of the opposite pad */
|
/* finish settings caps of the opposite pad */
|
||||||
@ -386,6 +364,7 @@ gst_videolevels_transform_caps (GstBaseTransform * base,
|
|||||||
NULL);
|
NULL);
|
||||||
structure = gst_caps_get_structure (newcaps, 0);
|
structure = gst_caps_get_structure (newcaps, 0);
|
||||||
gst_structure_remove_field (structure, "endianness");
|
gst_structure_remove_field (structure, "endianness");
|
||||||
|
gst_structure_remove_field (structure, "signed");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
GValue endianness = {0};
|
GValue endianness = {0};
|
||||||
@ -460,18 +439,16 @@ gst_videolevels_set_caps (GstBaseTransform * base, GstCaps * incaps,
|
|||||||
if (!res)
|
if (!res)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
/* retrieve input caps sign, or set to false if field doesn't exist */
|
||||||
if (!gst_structure_get (structure,
|
if (!gst_structure_get (structure,
|
||||||
"signed", G_TYPE_BOOLEAN, &levels->is_signed_in))
|
"signed", G_TYPE_BOOLEAN, &levels->is_signed_in))
|
||||||
levels->is_signed_in = FALSE;
|
levels->is_signed_in = FALSE;
|
||||||
|
|
||||||
/* retrieve src caps bpp/depth/endianness */
|
/* retrieve output bpp and depth */
|
||||||
structure = gst_caps_get_structure (incaps, 0);
|
structure = gst_caps_get_structure (outcaps, 0);
|
||||||
res = gst_structure_get (structure,
|
res = gst_structure_get (structure,
|
||||||
"width", G_TYPE_INT, &levels->width,
|
"bpp", G_TYPE_INT, &levels->bpp_out,
|
||||||
"height", G_TYPE_INT, &levels->height,
|
"depth", G_TYPE_INT, &levels->depth_out,
|
||||||
"bpp", G_TYPE_INT, &levels->bpp_in,
|
|
||||||
"depth", G_TYPE_INT, &levels->depth_in,
|
|
||||||
"endianness", G_TYPE_INT, &levels->endianness_in,
|
|
||||||
NULL);
|
NULL);
|
||||||
if (!res)
|
if (!res)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -479,6 +456,7 @@ gst_videolevels_set_caps (GstBaseTransform * base, GstCaps * incaps,
|
|||||||
levels->stride_in = GST_ROUND_UP_4 (levels->width * levels->depth_in/8);
|
levels->stride_in = GST_ROUND_UP_4 (levels->width * levels->depth_in/8);
|
||||||
levels->stride_out = GST_ROUND_UP_4 (levels->width * levels->depth_out/8);
|
levels->stride_out = GST_ROUND_UP_4 (levels->width * levels->depth_out/8);
|
||||||
|
|
||||||
|
|
||||||
gst_videolevels_calculate_tables (levels);
|
gst_videolevels_calculate_tables (levels);
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user