I have moved the pipeline to C code replacing nveglglessink with appsink.
I get the following error:
(appsink:11281): GLib-GObject-CRITICAL **: 15:09:49.871: g_object_set: assertion ‘G_IS_OBJECT (object)’ failed
(appsink:11281): GLib-GObject-WARNING **: 15:09:49.871: invalid (NULL) pointer instance
(appsink:11281): GLib-GObject-CRITICAL **: 15:09:49.871: g_signal_connect_data: assertion ‘G_TYPE_CHECK_INSTANCE (instance)’ failed
(appsink:11281): GStreamer-CRITICAL **: 15:09:49.872: gst_object_unref: assertion ‘object != NULL’ failed
Opening in BLOCKING MODE
Let’s run!
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
(appsink:11281): GStreamer-CRITICAL **: 15:09:51.403: gst_mini_object_unref: assertion ‘mini_object != NULL’ failed
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261
^C
This is my sample code that I am working on.
static GstFlowReturn
on_new_sample_from_sink (GstElement * elt, ProgramData * data)
{
GstSample *sample;
GstBuffer *app_buffer, *buffer;
GstElement *source;
GstFlowReturn ret;
/* get the sample from appsink */
sample = gst_app_sink_pull_sample (GST_APP_SINK (elt));
buffer = gst_sample_get_buffer (sample);
/* make a copy */
app_buffer = gst_buffer_copy (buffer);
printf("buffer size=%d\n",(int)gst_buffer_get_size(app_buffer));
/* we don't need the appsink sample anymore */
gst_sample_unref (sample);
/* get source an push new buffer */
//source = gst_bin_get_by_name (GST_BIN (data->sink), "testsource");
//ret = gst_app_src_push_buffer (GST_APP_SRC (source), app_buffer);
//gst_object_unref (source);
return ret;
}
static gboolean
on_source_message (GstBus * bus, GstMessage * message, ProgramData * data)
{
GstElement *source;
switch (GST_MESSAGE_TYPE (message)) {
case GST_MESSAGE_EOS:
g_print ("The source got dry\n");
//source = gst_bin_get_by_name (GST_BIN (data->sink), "testsource");
//gst_app_src_end_of_stream (GST_APP_SRC (source));
gst_object_unref (source);
break;
case GST_MESSAGE_ERROR:
g_print ("Received error\n");
g_main_loop_quit (data->loop);
break;
default:
break;
}
return TRUE;
}
int
main (int argc, char *argv[])
{
gchar *filename = NULL;
ProgramData *data = NULL;
gchar *string = NULL;
GstBus *bus = NULL;
GstElement *testsink = NULL;
GstElement *testsource = NULL;
gst_init (&argc, &argv);
if (argc == 2)
filename = g_strdup (argv[1]);
else
filename = g_strdup ("rtspsrc location='rtsp://admin:admin12345@192.168.1.21:554/Streaming/Channels/103' ! rtph264depay ! queue ! h264parse ! nvv4l2decoder ! nvvideoconvert ! appsink");
/*
if (!g_file_test (filename, G_FILE_TEST_EXISTS)) {
g_print ("File %s does not exist\n", filename);
g_free (filename);
return -1;
}
*/
data = g_new0 (ProgramData, 1);
data->loop = g_main_loop_new (NULL, FALSE);
/* setting up source pipeline, we read from a file and convert to our desired
* caps. */
string =
g_strdup_printf
("rtspsrc location=rtsp://admin:admin12345@192.168.1.21:554/Streaming/Channels/103 ! rtph264depay ! queue ! h264parse ! nvv4l2decoder ! nvvideoconvert ! appsink");
g_free (filename);
data->source = gst_parse_launch (string, NULL);
g_free (string);
if (data->source == NULL) {
g_print ("Bad source\n");
g_main_loop_unref (data->loop);
g_free (data);
return -1;
}
/* to be notified of messages from this pipeline, mostly EOS */
bus = gst_element_get_bus (data->source);
gst_bus_add_watch (bus, (GstBusFunc) on_source_message, data);
gst_object_unref (bus);
/* we use appsink in push mode, it sends us a signal when data is available
* and we pull out the data in the signal callback. We want the appsink to
* push as fast as it can, hence the sync=false */
testsink = gst_bin_get_by_name (GST_BIN (data->source), "testsink");
g_object_set (G_OBJECT (testsink), "emit-signals", TRUE, "sync", FALSE, NULL);
g_signal_connect (testsink, "new-sample",
G_CALLBACK (on_new_sample_from_sink), data);
gst_object_unref (testsink);
/* launching things */
gst_element_set_state (data->source, GST_STATE_PLAYING);
/* let's run !, this loop will quit when the sink pipeline goes EOS or when an
* error occurs in the source or sink pipelines. */
g_print ("Let's run!\n");
g_main_loop_run (data->loop);
g_print ("Going out\n");
gst_element_set_state (data->source, GST_STATE_NULL);
gst_object_unref (data->source);
gst_object_unref (data->sink);
g_main_loop_unref (data->loop);
g_free (data);
return 0;
}
Do you have any suggestions?
–