AW: AW: Seems like set callbacks unsuccessful

Thornton, Keith keith.thornton at zeiss.com
Thu Apr 19 07:18:12 UTC 2018


Hi, with the code you have provided I still can't see what you are doing but
I also have an appsink / appsrc construction in my rtsp streaming code which I handle by 

        if (m_pAppSink == nullptr) {
            m_pAppSink = gst_element_factory_make("appsink", "MySink");
            if (m_pAppSink == nullptr)
            {
                return false;
            }
            gst_object_ref(GST_OBJECT(m_pAppSink));

            GstAppSinkCallbacks appsinkCallbacks;
            appsinkCallbacks.new_preroll = prerollSampleCallback;
            appsinkCallbacks.new_sample = sampleCallback;
            appsinkCallbacks.eos = eosCallback;

            gst_app_sink_set_drop(GST_APP_SINK(m_pAppSink), true);
            gst_app_sink_set_callbacks(GST_APP_SINK(m_pAppSink), &appsinkCallbacks, this, nullptr);
        }

I then receive my buffers in the function sampleCallback which does the following

    GstFlowReturn BaseStreamer::sampleCallback(GstAppSink* appsink, gpointer user_data)
    {
        BaseStreamer* pStreamer = (BaseStreamer*)user_data;

        GstSample* pSample = gst_app_sink_pull_sample(appsink);
        if (!pSample) {
            return GST_FLOW_ERROR;
        }

        if (gst_app_src_push_sample(appSrc, pSample != GST_FLOW_OK) {
            gst_buffer_unref(pNewBuffer);
            gst_sample_unref(pNewSample);
            return GST_FLOW_ERROR;
        }
	}

The appsrc then gets the buffers.
I don't do anything with need-data on the appsrc side.
regards
-----Ursprüngliche Nachricht-----
Von: gstreamer-devel [mailto:gstreamer-devel-bounces at lists.freedesktop.org] Im Auftrag von Erickson.LU
Gesendet: Donnerstag, 19. April 2018 02:57
An: gstreamer-devel at lists.freedesktop.org
Betreff: Re: AW: Seems like set callbacks unsuccessful

Appreciate your reply, in the official they use signal but i used callback.
Of course, they are different. But, the problem is the callback function has never been called. I use breakpoint and g_print checked that. 
And when i use *pipeline_sink = gst_parse_launch (descr, &error); * They all went well. 

And there is *NewSampleCallback* and *NewPrerollCallback*.
GstFlowReturn NewSampleCallback(GstAppSink* appsink, gpointer user_data) {
    ReceiveNewSample();
    return GST_FLOW_OK;
}

GstFlowReturn NewPrerollCallback(GstAppSink* appsink, gpointer user_data) {
    GstSample* sample = gst_app_sink_pull_preroll(appsink);
    gst_sample_unref(sample);
    return GST_FLOW_OK;
}
Thanks again 





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
gstreamer-devel at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


More information about the gstreamer-devel mailing list