uvch264mjpgdemux: fix event ordering

This commit is contained in:
Tim-Philipp Müller 2013-08-10 21:33:36 +01:00
parent 86acf25ffc
commit 6f5934f3aa

View file

@ -144,6 +144,9 @@ struct _GstUvcH264MjpgDemuxPrivate
guint16 yuy2_height; guint16 yuy2_height;
guint16 nv12_width; guint16 nv12_width;
guint16 nv12_height; guint16 nv12_height;
/* input segment */
GstSegment segment;
}; };
typedef struct typedef struct
@ -365,14 +368,21 @@ gst_uvc_h264_mjpg_demux_sink_event (GstPad * pad, GstObject * parent,
GstEvent * event) GstEvent * event)
{ {
GstUvcH264MjpgDemux *self = GST_UVC_H264_MJPG_DEMUX (parent); GstUvcH264MjpgDemux *self = GST_UVC_H264_MJPG_DEMUX (parent);
gboolean res;
switch (GST_EVENT_TYPE (event)) { 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: 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: default:
res = gst_pad_event_default (pad, parent, event);
break; break;
} }
return gst_pad_event_default (pad, parent, event); return res;
} }
static gboolean static gboolean
@ -612,10 +622,9 @@ gst_uvc_h264_mjpg_demux_chain (GstPad * pad,
"width", G_TYPE_INT, aux_header.width, "width", G_TYPE_INT, aux_header.width,
"height", G_TYPE_INT, aux_header.height, "height", G_TYPE_INT, aux_header.height,
"framerate", GST_TYPE_FRACTION, fps_num, fps_den, NULL); "framerate", GST_TYPE_FRACTION, fps_num, fps_den, NULL);
if (!gst_pad_set_caps (aux_pad, *aux_caps)) { gst_pad_push_event (aux_pad, gst_event_new_caps (*aux_caps));
ret = GST_FLOW_NOT_NEGOTIATED; gst_pad_push_event (aux_pad,
goto done; gst_event_new_segment (&self->priv->segment));
}
} }
/* Create new auxiliary buffer list and adjust i/segment size */ /* Create new auxiliary buffer list and adjust i/segment size */