Send downstream event from application returns 0

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Send downstream event from application returns 0

mattias-12
Hi,

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.

Any ideas, please?

Here is some example code:
In application:
void SendNewBWEvent()
{
    GstEvent*      eventP;
    GstStructure*  s;
    GstEventType   eventType    = GST_EVENT_CUSTOM_DOWNSTREAM;



    s = gst_structure_new("vico",
              "msg", G_TYPE_STRING, "newBW",
              "bw", G_TYPE_INT, newBW,
              "port", G_TYPE_INT, port,
              NULL);
    if (s == NULL)
    exit_witherror(1, ("gst_structure_new returned NULL"));

    eventP = gst_event_new_custom(eventType, s);
    if (eventP == NULL)
    exit_witherror(1, ("gst_event_new returned NULL"));

    print("Sending new BW event\n");
    if (!gst_element_send_event(flowP->pipeline->gstParseLaunch.pipeline, eventP))
        exit_witherror(36, ("error sending newBW event to pipeline"));
}


In element:
--
gstbase_sink_class->event   = GST_DEBUG_FUNCPTR (gst_radvideosend_sink_event);

---

static gboolean
gst_radvideosend_sink_event (GstBaseSink * bsink, GstEvent * event)
{
    int bandWidth, port;

    GstRadvideosendSink *sink = GST_RADVIDEOSEND_SINK (bsink);

    GST_DEBUG("Received EVENT:::::::::::");
 
    switch (GST_EVENT_TYPE (event)) {
    case GST_EVENT_CUSTOM_DOWNSTREAM:
    {
    const GstStructure *structure;
    const gchar *event_type;

    structure = gst_event_get_structure (event);
    g_return_val_if_fail (structure != NULL, FALSE);

    event_type = gst_structure_get_string (structure, "msg");
    g_return_val_if_fail (event_type != NULL, FALSE);

    if (strcmp (event_type, "newBW") == 0) {

        gst_structure_get_int(structure, "bw", &bandWidth);
        gst_structure_get_int(structure, "port", &port);
        if (sink->NetParams.uiRemotePort == port) {
        GST_DEBUG("Received EVENT new BW %d, port %d:::::::::::", bandWidth, port);
        ChangeTransmittedBitrate(sink->hTrStream, bandWidth);
        }
        gst_event_unref (event);
    }
    else if (strcmp (event_type, "VFU") == 0) {

        gst_structure_get_int(structure, "port", &port);
        if (sink->NetParams.uiRemotePort == port) {
        GST_DEBUG("Received EVENT new IF port %d:::::::::::", port);
        SendIFrame(sink->hTrStream);
        }
        gst_event_unref (event);
       
    }
    break;
    }
    default:
    break;
    }


    if (GST_BASE_SINK_CLASS (parent_class)->event) {
    return GST_BASE_SINK_CLASS (parent_class)->event (bsink, event);
    } else {
    return TRUE;
    }
}


-- 
 Mattias Frank Barthel      
 Vía Augusta 177 08021 Barcelona (Spain)  T. 0034-93-365-3309
 TELEFÓNICA R&D

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel