<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
I am trying to send an event to a sink element from my application. I
am not sure though why the gst_element_send_event() returns 0 in this
case.<br>
<br>
Any ideas, please?<br>
<br>
Here is some example code:<br>
<small><font face="Courier New, Courier, monospace">In application:<br>
void SendNewBWEvent()<br>
{<br>
&nbsp;&nbsp;&nbsp; GstEvent*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; eventP;<br>
&nbsp;&nbsp;&nbsp; GstStructure*&nbsp; s;<br>
&nbsp;&nbsp;&nbsp; GstEventType&nbsp;&nbsp; eventType&nbsp;&nbsp;&nbsp; = GST_EVENT_CUSTOM_DOWNSTREAM;<br>
<br>
<br>
<br>
&nbsp;&nbsp;&nbsp; s = gst_structure_new("vico", <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; "msg", G_TYPE_STRING, "newBW",<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; "bw", G_TYPE_INT, newBW, <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; "port", G_TYPE_INT, port, <br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; NULL);<br>
&nbsp;&nbsp;&nbsp; if (s == NULL)<br>
&nbsp;&nbsp;&nbsp; exit_witherror(1, ("gst_structure_new returned NULL"));<br>
<br>
&nbsp;&nbsp;&nbsp; eventP = gst_event_new_custom(eventType, s);<br>
&nbsp;&nbsp;&nbsp; if (eventP == NULL)<br>
&nbsp;&nbsp;&nbsp; exit_witherror(1, ("gst_event_new returned NULL"));<br>
<br>
&nbsp;&nbsp;&nbsp; print("Sending new BW event\n");<br>
&nbsp;&nbsp;&nbsp; if
(!gst_element_send_event(flowP-&gt;pipeline-&gt;gstParseLaunch.pipeline,
eventP))<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; exit_witherror(36, ("error sending newBW event to pipeline"));<br>
}<br>
<br>
<br>
In element:<br>
--<br>
gstbase_sink_class-&gt;event&nbsp;&nbsp; = GST_DEBUG_FUNCPTR
(gst_radvideosend_sink_event);<br>
<br>
---<br>
<br>
static gboolean<br>
gst_radvideosend_sink_event (GstBaseSink * bsink, GstEvent * event)<br>
{<br>
&nbsp;&nbsp;&nbsp; int bandWidth, port;<br>
<br>
&nbsp;&nbsp;&nbsp; GstRadvideosendSink *sink = GST_RADVIDEOSEND_SINK (bsink);<br>
<br>
&nbsp;&nbsp;&nbsp; GST_DEBUG("Received EVENT:::::::::::");<br>
&nbsp; <br>
&nbsp;&nbsp;&nbsp; switch (GST_EVENT_TYPE (event)) {<br>
&nbsp;&nbsp;&nbsp; case GST_EVENT_CUSTOM_DOWNSTREAM:<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; const GstStructure *structure;<br>
&nbsp;&nbsp;&nbsp; const gchar *event_type;<br>
<br>
&nbsp;&nbsp;&nbsp; structure = gst_event_get_structure (event);<br>
&nbsp;&nbsp;&nbsp; g_return_val_if_fail (structure != NULL, FALSE);<br>
<br>
&nbsp;&nbsp;&nbsp; event_type = gst_structure_get_string (structure, "msg");<br>
&nbsp;&nbsp;&nbsp; g_return_val_if_fail (event_type != NULL, FALSE);<br>
<br>
&nbsp;&nbsp;&nbsp; if (strcmp (event_type, "newBW") == 0) {<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gst_structure_get_int(structure, "bw", &amp;bandWidth);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gst_structure_get_int(structure, "port", &amp;port);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (sink-&gt;NetParams.uiRemotePort == port) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; GST_DEBUG("Received EVENT new BW %d, port %d:::::::::::",
bandWidth, port);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ChangeTransmittedBitrate(sink-&gt;hTrStream, bandWidth);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gst_event_unref (event);<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; else if (strcmp (event_type, "VFU") == 0) {<br>
<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gst_structure_get_int(structure, "port", &amp;port);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (sink-&gt;NetParams.uiRemotePort == port) {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; GST_DEBUG("Received EVENT new IF port %d:::::::::::", port);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; SendIFrame(sink-&gt;hTrStream);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gst_event_unref (event);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; break;<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; default:<br>
&nbsp;&nbsp;&nbsp; break;<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
<br>
&nbsp;&nbsp;&nbsp; if (GST_BASE_SINK_CLASS (parent_class)-&gt;event) {<br>
&nbsp;&nbsp;&nbsp; return GST_BASE_SINK_CLASS (parent_class)-&gt;event (bsink, event);<br>
&nbsp;&nbsp;&nbsp; } else {<br>
&nbsp;&nbsp;&nbsp; return TRUE;<br>
&nbsp;&nbsp;&nbsp; }<br>
}<br>
<br>
<br>
</font></small>
<pre class="moz-signature" cols="800">-- 
 Mattias Frank Barthel      
 V&iacute;a Augusta 177 08021 Barcelona (Spain)  T. 0034-93-365-3309
 TELEF&Oacute;NICA R&amp;D
</pre>
</body>
</html>