<!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>
GstEvent* eventP;<br>
GstStructure* s;<br>
GstEventType eventType = GST_EVENT_CUSTOM_DOWNSTREAM;<br>
<br>
<br>
<br>
s = gst_structure_new("vico", <br>
"msg", G_TYPE_STRING, "newBW",<br>
"bw", G_TYPE_INT, newBW, <br>
"port", G_TYPE_INT, port, <br>
NULL);<br>
if (s == NULL)<br>
exit_witherror(1, ("gst_structure_new returned NULL"));<br>
<br>
eventP = gst_event_new_custom(eventType, s);<br>
if (eventP == NULL)<br>
exit_witherror(1, ("gst_event_new returned NULL"));<br>
<br>
print("Sending new BW event\n");<br>
if
(!gst_element_send_event(flowP->pipeline->gstParseLaunch.pipeline,
eventP))<br>
exit_witherror(36, ("error sending newBW event to pipeline"));<br>
}<br>
<br>
<br>
In element:<br>
--<br>
gstbase_sink_class->event = GST_DEBUG_FUNCPTR
(gst_radvideosend_sink_event);<br>
<br>
---<br>
<br>
static gboolean<br>
gst_radvideosend_sink_event (GstBaseSink * bsink, GstEvent * event)<br>
{<br>
int bandWidth, port;<br>
<br>
GstRadvideosendSink *sink = GST_RADVIDEOSEND_SINK (bsink);<br>
<br>
GST_DEBUG("Received EVENT:::::::::::");<br>
<br>
switch (GST_EVENT_TYPE (event)) {<br>
case GST_EVENT_CUSTOM_DOWNSTREAM:<br>
{<br>
const GstStructure *structure;<br>
const gchar *event_type;<br>
<br>
structure = gst_event_get_structure (event);<br>
g_return_val_if_fail (structure != NULL, FALSE);<br>
<br>
event_type = gst_structure_get_string (structure, "msg");<br>
g_return_val_if_fail (event_type != NULL, FALSE);<br>
<br>
if (strcmp (event_type, "newBW") == 0) {<br>
<br>
gst_structure_get_int(structure, "bw", &bandWidth);<br>
gst_structure_get_int(structure, "port", &port);<br>
if (sink->NetParams.uiRemotePort == port) {<br>
GST_DEBUG("Received EVENT new BW %d, port %d:::::::::::",
bandWidth, port);<br>
ChangeTransmittedBitrate(sink->hTrStream, bandWidth);<br>
}<br>
gst_event_unref (event);<br>
}<br>
else if (strcmp (event_type, "VFU") == 0) {<br>
<br>
gst_structure_get_int(structure, "port", &port);<br>
if (sink->NetParams.uiRemotePort == port) {<br>
GST_DEBUG("Received EVENT new IF port %d:::::::::::", port);<br>
SendIFrame(sink->hTrStream);<br>
}<br>
gst_event_unref (event);<br>
<br>
}<br>
break;<br>
}<br>
default:<br>
break;<br>
}<br>
<br>
<br>
if (GST_BASE_SINK_CLASS (parent_class)->event) {<br>
return GST_BASE_SINK_CLASS (parent_class)->event (bsink, event);<br>
} else {<br>
return TRUE;<br>
}<br>
}<br>
<br>
<br>
</font></small>
<pre class="moz-signature" cols="800">--
Mattias Frank Barthel
Vía Augusta 177 08021 Barcelona (Spain) T. 0034-93-365-3309
TELEFÓNICA R&D
</pre>
</body>
</html>