Unable to get the sample from Appsink using C++

RK29 giri_2984 at yahoo.co.in
Fri Aug 21 16:07:07 UTC 2020


I followed your example now I am getting Exception thrown at
0x000000006DC5459D (libgstreamer-1.0-0.dll) in bmpTest.exe: 0xC0000005:
Access violation reading location 0xFFFFFFFFFFFFFFFF.

when I do gst_bin_add_many(


static void
on_incoming_decodebin_stream (GstElement * decodebin, GstPad * pad,
                              GstElement * pipe)
{
    GstCaps *caps;
    const gchar *name;

    if (!gst_pad_has_current_caps (pad)) {
        g_printerr ("Pad '%s' has no caps, can't do anything, ignoring\n",
                    GST_PAD_NAME (pad));
        return;
    }

    caps = gst_pad_get_current_caps (pad);
    name = gst_structure_get_name (gst_caps_get_structure (caps, 0));

    if (g_str_has_prefix (name, "video")) {
       // handle_media_stream (pad, pipe, "videoconvert", "autovideosink");
        // Create our user data
        UserData* user_data = new UserData();
        user_data->pipeline = pipe;
        GstElement* queue = gst_element_factory_make("queue", "dasQueue");
        GstElement* videoconvert = gst_element_factory_make("videoconvert",
"dasvideoconvert");
        GstElement* videoscale = gst_element_factory_make("videoscale",
"dasvideoscale");
        GstCaps* caps = gst_caps_from_string("video/x-raw,format=BGR, width=
1280, height=720");
        GstElement* appSink = gst_element_factory_make("appsink",
"dasCapAppSink");

        // Set all the callbacks
        gst_app_sink_set_emit_signals((GstAppSink*)appSink, true);
        gst_app_sink_set_drop((GstAppSink*)appSink, true);
        gst_app_sink_set_max_buffers((GstAppSink*)appSink, 3);				// Limit
the number of buffers the appsink can store if we don't take anything from
it
        GstAppSinkCallbacks callbacks = { NULL, NULL, new_sample1 };	
// These are the functions called when we get a new preroll (new_preroll)
and a new buffer/image (new_sample)
        gst_app_sink_set_callbacks(GST_APP_SINK(appSink), &callbacks,
user_data, NULL); // 'data' is just some user data sent to the callback so
you can update your own data, if needed

        // Add everything to the pipeline
        gst_bin_add_many(GST_BIN(user_data->pipeline), queue, videoconvert,
videoscale,caps, appSink);




       // handle_media_stream(pad, pipe, "videoconvert", "appsink");
    } else if (g_str_has_prefix (name, "audio")) {
       // handle_media_stream (pad, pipe, "audioconvert", "autoaudiosink");
    } else {
        g_printerr ("Unknown pad %s, ignoring", GST_PAD_NAME (pad));
    }

}



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list