I have a simple code with c++ using gstreamer to read rtsp video. I'm new to gstreamer, I couldn't concatenate gst_parse_launch() with a URL_RTSP variable for my rtsp links.
here is no variable URL_RTSP, that works:
/* Build the pipeline */
pipeline = gst_parse_launch("rtspsrc protocols=tcp location=rtsp://user:pass@protocol:port/cam/realmonitor?channel=1&subtype=0 latency=300 ! decodebin3 ! autovideosink", NULL);
/* Start playing */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
with the variable URL_RTSP, doesn't work:
/*Url Cams*/
std::string URL_RTSP = "rtsp://user:pass@protocol:port/cam/realmonitor?channel=1&subtype=0";
/* Build the pipeline */
pipeline =
gst_parse_launch("rtspsrc protocols=tcp location="+ URL_RTSP + " latency=300 ! decodebin3 ! autovideosink", NULL);
/* Start playing */
gst_element_set_state (pipeline, GST_STATE_PLAYING);
Error when I try to use with variable, gst_parse_launch() get the error:
there is no proper conversion function from "std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>" to "const gchar *"