appsink with new-sample gstreamer 1.6

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

appsink with new-sample gstreamer 1.6

killerrats
This post was updated on .
I have written the following to get the appsink from the pipeline to then get the buffer from the appsink. I was able to successfully make a grab seems like since no errors. I put the cout in the beginning to see if I got a signal but the cout in the first line of the function doesn't event show. It's like there is nothing that i coming in or what. Any Ideas? If need more code, I can provide.

PIPELINE:
---------------------
_videoD.srcPipeline =
"rtspsrc location=videoURI name=rtspsrc "\
                        "! rtph264depay ! h264parse "\
                        "! mpegpsmux name=mux ! appsink blocksize=100 sync=false max-buffers=1 name=EOfSinkName rtspsrc. "\
                        "! rtpmp4gdepay ! decodebin ! mux.

CALL:
--------------------------
_videoD.sink = gst_bin_get_by_name(GST_BIN(_videoD.srcPipeline),_videoD._EOSsink.c_str());
        gst_element_set_locked_state(_videoD.sink,TRUE);
        g_signal_connect (_videoD.sink, "new-sample",  G_CALLBACK (appsink_ToFile),&_videoD);

FUNCTION:
---------------------------------------
GstFlowReturn PipelineClass::appsink_ToFile (GstElement* object,VideoData user_data)
{
        std::cout << "Entered----------------------------------------------------------------------" << std::endl;
       
        GstSample* sample = NULL;
        GstCaps* caps;
        GstBuffer* buffer;
        GstMapInfo map;
        g_signal_emit_by_name(user_data.sink,"pull-sample",&sample);

       
        if(sample != NULL)
        {
               
                std::cout << "Got Sample----------------------------------------------------" << std::endl;
                FILE* ufile = file;
          //GstAppSink* app_sink = (GstAppSink*) object;
          //GstSample * sample = gst_app_sink_pull_sample(app_sink);
          buffer = gst_sample_get_buffer(sample);
          caps = gst_sample_get_caps(sample);

          if(gst_buffer_map (buffer, &map, GST_MAP_READ))
          gst_util_dump_mem (map.data, map.size);
               
          gst_buffer_unmap (buffer, &map);
          gst_sample_unref(sample);
        }
        else
        {
                std::cout << "no sample" << std::endl;
        }

        return GST_FLOW_OK;
   
}
------------------------------
Gstreamer 1.14.3
------------------------------
Windows