gst-plugin-aml-v4l2dec: get PAR from decoder and set it to caps. [1/2]
PD#SWPL-149833
Problem:
Caps have un-correct pixel_aspect_ratio
Solution:
get PAR from decoder and set it to caps
Verify:
AH212
Change-Id: I51fcf209dfbf458e5437360aed3fbceb5fbc792a
Signed-off-by: sheng.liu <sheng.liu@amlogic.com>
diff --git a/src/gstamlv4l2videodec.c b/src/gstamlv4l2videodec.c
index ba6ef4c..9598a0a 100644
--- a/src/gstamlv4l2videodec.c
+++ b/src/gstamlv4l2videodec.c
@@ -1562,6 +1562,7 @@
{
GstCaps *caps;
GstStructure *structure;
+ gint num, denom;
gst_event_parse_caps (event, &caps);
structure= gst_caps_get_structure(caps, 0);
@@ -1574,6 +1575,26 @@
GST_DEBUG("frame parsed:%d, set stream_mode to %d", parsed, self->v4l2output->stream_mode);
}
}
+
+ if (( gst_structure_get_fraction( structure, "pixel-aspect-ratio", &num, &denom ) ) &&
+ ( !self->v4l2capture->have_set_par ) )
+ {
+ if ( (num <= 0) || (denom <= 0) )
+ {
+ num= denom= 1;
+ }
+
+ if ( self->v4l2capture->par )
+ {
+ g_value_unset(self->v4l2capture->par);
+ g_free(self->v4l2capture->par);
+ }
+
+ self->v4l2capture->par = g_new0(GValue, 1);
+ g_value_init(self->v4l2capture->par, GST_TYPE_FRACTION);
+ gst_value_set_fraction(self->v4l2capture->par, num, denom);
+ GST_DEBUG_OBJECT(self, "get pixel aspect ratio %d:%d", num, denom);
+ }
break;
}
case GST_EVENT_FLUSH_START: