<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
In general, you can debug by running your program with the command option --gst-debug=4 (or some other level, I usually go between 3 and 5, see docs for more info). This should help narrow down what the error is, just search the console output for any CRITICAL
or WARNING messages.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
To get this command option to do anything in your program, you have to pass the program arguments to GStreamer by changing the init function to </div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
gst_init(argc, argv); </div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> gstreamer-devel <gstreamer-devel-bounces@lists.freedesktop.org> on behalf of alisemih <ali.semih.yilmaz@hotmail.com><br>
<b>Sent:</b> Friday, September 4, 2020 5:24 AM<br>
<b>To:</b> gstreamer-devel@lists.freedesktop.org <gstreamer-devel@lists.freedesktop.org><br>
<b>Subject:</b> Internal data stream error:</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Hi everyone,<br>
I'm trying to develop c application for rtspsrc.<br>
<br>
My pipeline: <br>
<br>
gst-launch-1.0 rtspsrc location=rtsp://192.168.1.43:554/stream0 latency=0<br>
name=src src. ! rtph264depay ! queue ! h264parse ! vpudec ! videoconvert !<br>
videoscale ! waylandsink window-width=352 window-height=288<br>
<br>
<br>
The pipeline runs succesfull with gst-launch. And i want to write this<br>
pipeline's c code. So i tried to write c code that the following in below.<br>
The pipeline elements linked successfull. When i set playing state of<br>
pipeline i've got "Internal data stream error".<br>
<br>
How can i fix this problem? Can anyone help me?<br>
<br>
My C code:<br>
<br>
#include <gst/gst.h><br>
#include <string.h><br>
#include <stdlib.h><br>
#include <stdio.h><br>
/* Structure to contain all our information, so we can pass it to callbacks<br>
*/<br>
typedef struct _Data {<br>
GstElement *pipeline;<br>
GstElement *source;<br>
GstElement *videoQueue;<br>
GstElement *videoParser;<br>
GstElement *videoDepayloader;<br>
GstElement *videoDecoder;<br>
GstElement *videoSink;<br>
GstElement *videoConvert;<br>
GstElement *videoScale;<br>
} Data;<br>
/* Handler for the pad-added signal */<br>
<br>
int main(int argc, char *argv[]) {<br>
Data data;<br>
GstBus *bus;<br>
GstMessage *msg;<br>
GstPad *pad;<br>
gboolean terminate = FALSE;<br>
GstStateChangeReturn ret;<br>
<br>
/* Initialize GStreamer */<br>
gst_init (NULL,NULL);<br>
data.source = gst_element_factory_make ("rtspsrc", "source");<br>
data.videoQueue = gst_element_factory_make ("queue", "videoQueue");<br>
data.videoDepayloader = gst_element_factory_make ("rtph264depay",<br>
"videoDepayloader");<br>
data.videoDecoder = gst_element_factory_make ("vpudec", "videoDecoder");<br>
data.videoSink = gst_element_factory_make ("waylandsink", "videoSink");<br>
data.videoParser = gst_element_factory_make("h264parse", "videoParser");<br>
data.videoConvert = gst_element_factory_make("videoconvert",<br>
"video-convert");<br>
data.videoScale = gst_element_factory_make("videoscale", "videoScale");<br>
<br>
/* Create the empty pipeline */<br>
data.pipeline = gst_pipeline_new ("rtsp-pipeline");<br>
<br>
<br>
if (!data.source) {<br>
g_printerr ("source elements could be created.\n");<br>
return -1;<br>
}<br>
if(!data.videoQueue){<br>
g_printerr ("videoQueue elements could be created.\n");<br>
return -1;<br>
}<br>
if(!data.videoDepayloader){<br>
g_printerr ("videoDepayloader elements could be created.\n");<br>
return -1;<br>
}<br>
if(!data.videoDecoder){<br>
g_printerr ("videoDecoder elements could be created.\n");<br>
return -1;<br>
}<br>
if(!data.videoSink){<br>
g_printerr ("videoSink elements could be created.\n");<br>
return -1;<br>
}<br>
if(!data.videoParser){<br>
g_printerr ("videoParser elements could be created.\n");<br>
return -1;<br>
}<br>
if(!data.videoConvert){<br>
g_printerr ("videoConvert elements could be created.\n");<br>
return -1;<br>
}<br>
if(!data.videoScale){<br>
g_printerr ("videoScale elements could be created.\n");<br>
return -1;<br>
}<br>
/* Configure elements */<br>
g_object_set(data.source, "location", "rtsp://192.168.1.43/h264cif",<br>
NULL);<br>
g_object_set(data.source, "latency", 0, NULL);<br>
<br>
gst_bin_add_many (GST_BIN (data.pipeline), data.source,<br>
data.videoDepayloader, data.videoQueue, data.videoParser, data.videoDecoder,<br>
data.videoConvert, data.videoScale, data.videoSink, NULL);<br>
<br>
if(!gst_element_link(data.videoDepayloader, data.videoQueue)){<br>
g_printerr("Error linking payloader -> queue \n");<br>
exit (-1);<br>
}<br>
else<br>
{<br>
g_print("payloader -> queue linked\n");<br>
}<br>
<br>
if(!gst_element_link(data.videoQueue, data.videoParser)){<br>
g_printerr("Error linking queue -> parser \n");<br>
exit (-1);<br>
}<br>
else<br>
{<br>
g_print("queue -> parser linked\n");<br>
}<br>
if(!gst_element_link(data.videoParser, data.videoDecoder)){<br>
g_printerr("Error linking parser -> decoder \n");<br>
exit (-1);<br>
}<br>
else<br>
{<br>
g_print("queue -> parser linked\n");<br>
}<br>
if(!gst_element_link(data.videoDecoder, data.videoConvert)){<br>
g_printerr("Error linking decoder -> convert \n");<br>
exit (-1);<br>
}<br>
else<br>
{<br>
g_print("decoder -> convert linked\n");<br>
}<br>
if(!gst_element_link(data.videoConvert, data.videoScale)){<br>
g_printerr("Error linking convert -> scale \n");<br>
exit (-1);<br>
}<br>
else<br>
{<br>
g_print("convert -> scale linked\n");<br>
}<br>
if(!gst_element_link(data.videoScale, data.videoSink)){<br>
g_printerr("Error linking scale ->sink \n");<br>
exit (-1);<br>
}<br>
else<br>
{<br>
g_print("scale ->sink linked\n");<br>
}<br>
<br>
/* Start playing */<br>
<br>
ret = gst_element_set_state (data.pipeline, GST_STATE_PLAYING);<br>
<br>
if (ret == GST_STATE_CHANGE_FAILURE) {<br>
g_print ("Unable to set the pipeline to the playing state.\n");<br>
gst_object_unref (data.pipeline);<br>
exit(1);<br>
}<br>
<br>
/* Listen to the bus */<br>
bus = gst_element_get_bus (data.pipeline);<br>
do {<br>
msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE,<br>
GST_MESSAGE_STATE_CHANGED | GST_MESSAGE_ERROR | GST_MESSAGE_EOS);<br>
<br>
/* Parse message */<br>
if (msg != NULL) {<br>
GError *err;<br>
gchar *debug_info;<br>
<br>
switch (GST_MESSAGE_TYPE (msg)) {<br>
case GST_MESSAGE_ERROR:<br>
gst_message_parse_error (msg, &err, &debug_info);<br>
g_printerr ("Error received from element %s: %s\n",<br>
GST_OBJECT_NAME (msg->src), err->message);<br>
g_printerr ("Debugging information: %s\n", debug_info ? debug_info<br>
: "none");<br>
g_clear_error (&err);<br>
g_free (debug_info);<br>
terminate = TRUE;<br>
break;<br>
case GST_MESSAGE_EOS:<br>
g_print ("End-Of-Stream reached.\n");<br>
terminate = TRUE;<br>
break;<br>
case GST_MESSAGE_STATE_CHANGED:<br>
/* We are only interested in state-changed messages from the<br>
pipeline */<br>
if (GST_MESSAGE_SRC (msg) == GST_OBJECT (data.pipeline)) {<br>
GstState old_state, new_state, pending_state;<br>
gst_message_parse_state_changed (msg, &old_state, &new_state,<br>
&pending_state);<br>
g_print ("Pipeline state changed from %s to %s:\n",<br>
gst_element_state_get_name (old_state),<br>
gst_element_state_get_name (new_state));<br>
}<br>
break;<br>
default:<br>
/* We should not reach here */<br>
g_printerr ("Unexpected message received.\n");<br>
break;<br>
}<br>
gst_message_unref (msg);<br>
}<br>
} while (!terminate);<br>
/* Free resources */<br>
gst_object_unref (bus);<br>
gst_element_set_state (data.pipeline, GST_STATE_NULL);<br>
gst_object_unref (data.pipeline);<br>
return 0;<br>
}<br>
<br>
<br>
<br>
<br>
--<br>
Sent from: <a href="http://gstreamer-devel.966125.n4.nabble.com/">http://gstreamer-devel.966125.n4.nabble.com/</a><br>
_______________________________________________<br>
gstreamer-devel mailing list<br>
gstreamer-devel@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel">https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
</div>
</span></font></div>
</body>
</html>