diff -Nru gst-openmax-0.10.0.4+ti1.5.3.3/debian/changelog gst-openmax-0.10.0.4+ti1.5.4.1/debian/changelog --- gst-openmax-0.10.0.4+ti1.5.3.3/debian/changelog 2012-04-30 11:36:37.000000000 +0000 +++ gst-openmax-0.10.0.4+ti1.5.4.1/debian/changelog 2012-04-30 11:36:37.000000000 +0000 @@ -1,3 +1,9 @@ +gst-openmax (0.10.0.4+ti1.5.4.1-1) oneiric; urgency=low + + * New upstream release, based on commit 0fcde578 + + -- Olivier Naudan Mon, 23 Apr 2012 06:50:02 -0400 + gst-openmax (0.10.0.4+ti1.5.3.3-1) oneiric; urgency=low * New upstream release, based on commit b9e09e53 diff -Nru gst-openmax-0.10.0.4+ti1.5.3.3/omx/gstomx_camera.c gst-openmax-0.10.0.4+ti1.5.4.1/omx/gstomx_camera.c --- gst-openmax-0.10.0.4+ti1.5.3.3/omx/gstomx_camera.c 2011-12-20 16:05:06.000000000 +0000 +++ gst-openmax-0.10.0.4+ti1.5.4.1/omx/gstomx_camera.c 2012-04-23 10:49:10.000000000 +0000 @@ -86,6 +86,7 @@ */ static void create_ports (GstOmxCamera *self); +static GstClockTime get_latency (GstOmxCamera * self); static const GstElementDetails element_details = GST_ELEMENT_DETAILS ("Video OMX Camera Source", @@ -313,21 +314,12 @@ GstVideoFormat format; gint width, height, rowstride = 0; - gint framerate_num, framerate_denom; const GValue *framerate = NULL; + guint32 xFramerate; OMX_ERRORTYPE err; - if (!self) - { - GST_DEBUG_OBJECT (pad, "pad has no parent (yet?)"); - return TRUE; // ??? - } - GST_INFO_OBJECT (omx_base, "setcaps (src/vidsrc): %" GST_PTR_FORMAT, caps); - g_return_val_if_fail (caps, FALSE); - g_return_val_if_fail (gst_caps_is_fixed (caps), FALSE); - if (gst_video_format_parse_caps_strided (caps, &format, &width, &height, &rowstride)) { @@ -373,21 +365,17 @@ framerate = gst_structure_get_value ( gst_caps_get_structure (caps, 0), "framerate"); + gst_structure_get_fraction (gst_caps_get_structure (caps, 0), + "framerate", &self->fps_n, &self->fps_d); - if (framerate) - { - guint32 xFramerate; - framerate_num = gst_value_get_fraction_numerator (framerate); - framerate_denom = gst_value_get_fraction_denominator (framerate); - xFramerate = (framerate_num << 16) / framerate_denom; + xFramerate = (self->fps_n << 16) / self->fps_d; - if (param.format.video.xFramerate != xFramerate) - { - param.format.video.xFramerate = xFramerate; - configure_port = TRUE; - } - } + if (param.format.video.xFramerate != xFramerate) + { + param.format.video.xFramerate = xFramerate; + configure_port = TRUE; + } /* At the moment we are only using preview port and not vid_port * From omx camera desing document we are missing @@ -655,6 +643,26 @@ return TRUE; } +static GstClockTime +get_latency (GstOmxCamera * self) +{ + if (G_UNLIKELY (self->latency == GST_CLOCK_TIME_NONE)) { + if (self->fps_d == 0) { + GST_INFO_OBJECT (self, "not ready to report latency"); + return GST_CLOCK_TIME_NONE; + } + + if (self->fps_n != 0) + self->latency = gst_util_uint64_scale (GST_SECOND, + 4 * self->fps_d, self->fps_n); + else + self->latency = 0; + + } + + return self->latency; +} + static gboolean src_query (GstPad *pad, GstQuery *query) { @@ -668,25 +676,11 @@ { case GST_QUERY_BUFFERS: { - const GstCaps *caps; OMX_ERRORTYPE err; OMX_PARAM_PORTDEFINITIONTYPE param; _G_OMX_INIT_PARAM (¶m); - gst_query_parse_buffers_caps (query, &caps); - - /* ensure the caps we are querying are the current ones, otherwise - * results are meaningless.. - * - * @todo should we save and restore current caps?? - */ -#if 0 - /* FIXME: why is this needed? it breaks renegotiation happening inside - * camerabin2 */ - src_setcaps (pad, (GstCaps *)caps); -#endif - param.nPortIndex = omx_base->out_port->port_index; err = OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamPortDefinition, ¶m); @@ -721,15 +715,24 @@ case GST_QUERY_LATENCY: { - GstClockTime min, max; + GstClockTime min, max, latency; - /* FIXME this is hardcoded for now but we should try to do better */ - min = 0; - max = GST_CLOCK_TIME_NONE; - gst_query_set_latency (query, TRUE, min, max); + gst_query_parse_latency (query, NULL, &min, &max); + latency = get_latency (self); + if (min == GST_CLOCK_TIME_NONE) + min = latency; + else + min += latency; + + if (max != GST_CLOCK_TIME_NONE) + max += latency; + + GST_INFO_OBJECT (self, "reporting latency %"GST_TIME_FORMAT, + GST_TIME_ARGS (min)); + gst_query_set_latency (query, TRUE, min, max); - ret = TRUE; - break; + ret = TRUE; + break; } default: @@ -920,25 +923,16 @@ GST_OBJECT_UNLOCK (self); if (clock) { - /* the time now is the time of the clock minus the base time */ - /* Hack: Need to subtract the extra lag that is causing problems to AV sync */ + GstClockTime latency = get_latency (self); timestamp = gst_clock_get_time (clock) - timestamp; gst_object_unref (clock); - /* if we have a framerate adjust timestamp for frame latency */ -#if 0 - if (self->fps_n > 0 && self->fps_d > 0) - { - GstClockTime latency; - - latency = gst_util_uint64_scale_int (GST_SECOND, self->fps_d, self->fps_n); - + if (GST_CLOCK_TIME_IS_VALID (latency)) { if (timestamp > latency) timestamp -= latency; else timestamp = 0; } -#endif } return timestamp; @@ -1055,6 +1049,9 @@ self->next_mode = self->mode; self->mode = -1; + self->fps_n = 0; + self->fps_d = 0; + self->latency = GST_CLOCK_TIME_NONE; create_ports (self); return TRUE; @@ -1459,6 +1456,10 @@ channel->max_value = 100; self->channels = g_list_append (self->channels, channel); + self->fps_n = 0; + self->fps_d = 0; + self->latency = -1; + GST_DEBUG_OBJECT (omx_base, "end"); } diff -Nru gst-openmax-0.10.0.4+ti1.5.3.3/omx/gstomx_camera.h gst-openmax-0.10.0.4+ti1.5.4.1/omx/gstomx_camera.h --- gst-openmax-0.10.0.4+ti1.5.3.3/omx/gstomx_camera.h 2011-12-20 16:05:06.000000000 +0000 +++ gst-openmax-0.10.0.4+ti1.5.4.1/omx/gstomx_camera.h 2012-04-23 10:49:10.000000000 +0000 @@ -58,6 +58,9 @@ GList *channels; gint rowstride; /**< rowstride of preview/video buffer */ + gint fps_n; + gint fps_d; + GstClockTime latency; GOmxPort *vid_port; GOmxPort *img_port;