From 6f5934f3aa9822673ed25343d8ba7e011ad7a407 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 10 Aug 2013 21:33:36 +0100 Subject: [PATCH] uvch264mjpgdemux: fix event ordering --- sys/uvch264/gstuvch264_mjpgdemux.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/sys/uvch264/gstuvch264_mjpgdemux.c b/sys/uvch264/gstuvch264_mjpgdemux.c index e42cd49a28..3ff73aca72 100644 --- a/sys/uvch264/gstuvch264_mjpgdemux.c +++ b/sys/uvch264/gstuvch264_mjpgdemux.c @@ -144,6 +144,9 @@ struct _GstUvcH264MjpgDemuxPrivate guint16 yuy2_height; guint16 nv12_width; guint16 nv12_height; + + /* input segment */ + GstSegment segment; }; typedef struct @@ -365,14 +368,21 @@ gst_uvc_h264_mjpg_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) { GstUvcH264MjpgDemux *self = GST_UVC_H264_MJPG_DEMUX (parent); + gboolean res; switch (GST_EVENT_TYPE (event)) { + case GST_EVENT_SEGMENT: + gst_event_copy_segment (event, &self->priv->segment); + res = gst_pad_push_event (self->priv->jpeg_pad, event); + break; case GST_EVENT_CAPS: - return gst_pad_push_event (self->priv->jpeg_pad, event); + res = gst_pad_push_event (self->priv->jpeg_pad, event); + break; default: + res = gst_pad_event_default (pad, parent, event); break; } - return gst_pad_event_default (pad, parent, event); + return res; } static gboolean @@ -612,10 +622,9 @@ gst_uvc_h264_mjpg_demux_chain (GstPad * pad, "width", G_TYPE_INT, aux_header.width, "height", G_TYPE_INT, aux_header.height, "framerate", GST_TYPE_FRACTION, fps_num, fps_den, NULL); - if (!gst_pad_set_caps (aux_pad, *aux_caps)) { - ret = GST_FLOW_NOT_NEGOTIATED; - goto done; - } + gst_pad_push_event (aux_pad, gst_event_new_caps (*aux_caps)); + gst_pad_push_event (aux_pad, + gst_event_new_segment (&self->priv->segment)); } /* Create new auxiliary buffer list and adjust i/segment size */