Gstreamer RTSP src element name

Tarun Tej K tarun4690 at gmail.com
Mon Jan 23 16:53:10 UTC 2017


Hi,

rtspsrc emits the signal "pad-added" twice. Once for audio and once for
video.

We can use a g_signal_connect() to catch the pad and link it to our video
and audio queues seperately in a callback function.

E.g.:


//Call back function to link the pads from rtspsrc
Void *sig_call_back(GstElement * element, GstPad *pad, char *data)
{
//Check for type of pad using pad

//If audio type pad, link with audioQueue

//If video type pad, link with videoQueue

//Declaring the audioQueue and videoQueue as global would be easier way or
use 'data' variable as pointer sent by g_singal_connect
}

main(){
...
...
rtsp_source= gst_element_factory_make ("rtspsrc", "rtsp-source");
....
....
*Linking procedure*
  g_signal_connect(rtsp_source,"pad-added", sig_call_back, some_ptr);
.....
...
}


On 23-Jan-2017 5:35 PM, "rajvik" <kamdar.rajvi at gmail.com> wrote:

> I am trying to link audio and video queue's using rtspsrc element property
> name. The pipeline is:
> *gst-launch-1.0 rtspsrc location="rtsp://<file path>"  latency=0 name=demux
> demux. ! queue !  rtpmp4gdepay ! aacparse ! avdec_aac !  audioconvert !
> audioresample ! autoaudiosink demux. ! queue ! rtph264depay ! h264parse !
> omxh264dec ! videoconvert ! videoscale ! video/x-raw,width=176, height=144
> !
> ximagesink*
>
> I could create the value of name element using
> *g_object_set(source, "name", "demux", NULL);*
> But I am not able to link audio and video queues hence create. Following is
> the part of code:
>
> *audio bin*
>        audio = gst_bin_new ("audiobin");
>         audioQueue = gst_element_factory_make ("queue", "audio-queue");
>         audioDepay = gst_element_factory_make ("rtpmp4gdepay",
> "audio-depayer");
>         audioParse = gst_element_factory_make ("aacparse", "audio-parser");
>         audioDecode = gst_element_factory_make ("avdec_aac",
> "audio-decoder");
>         audioConvert = gst_element_factory_make ("audioconvert", "aconv");
>         audioResample = gst_element_factory_make ("audioresample",
> "audio-resample");
>         audioSink = gst_element_factory_make ("autoaudiosink",
> "audiosink");
>
> *video bin*
>         video  = gst_bin_new ("videobin");
>         videoQueue = gst_element_factory_make ("queue", "video-queue");
>         videoDepay= gst_element_factory_make ("rtph264depay",
> "video-depayer");
>         videoParser = gst_element_factory_make ("h264parse",
> "video-parser");
>         videoDecode = gst_element_factory_make ("omxh264dec",
> "video-decoder");
>         videoConvert = gst_element_factory_make("videoconvert",
> "convert");
>         videoScale = gst_element_factory_make("videoscale",
> "video-scale");
>         videoSink = gst_element_factory_make("ximagesink", "video-sink");
>         capsFilter = gst_caps_new_simple("video/x-raw",
>                         "width", G_TYPE_INT, 176,
>                         "height", G_TYPE_INT, 144,
>                         NULL);
>
> *Linking procedure*
>
>      /*Linking filter element to videoScale and videoSink */
>         link_ok = gst_element_link_filtered(videoScale,videoSink,
> capsFilter);
>         gst_caps_unref (capsFilter);
>         if (!link_ok) {
>                 g_warning ("Failed to link element1 and element2!");
>         }
>         /* Linking video elements internally */
>         if (!gst_element_link_many(videoQueue, videoDepay, videoParser,
> videoDecode, videoConvert, NULL))
>         {
>                 g_printerr("Cannot link videoDepay and videoParser \n");
>                 return 0;
>         }
>         if (!gst_element_link_many(audioQueue, audioDepay, audioParse,
> audioDecode, audioConvert, audioResample, audioSink, NULL))
>         {
>                 g_printerr("Cannot link audioDepay and audioParse \n");
>                 return 0;
>         }
>
> *Help is highly appreciated*
>
>
>
> --
> View this message in context: http://gstreamer-devel.966125.
> n4.nabble.com/Gstreamer-RTSP-src-element-name-tp4681595.html
> Sent from the GStreamer-devel mailing list archive at Nabble.com.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20170123/93d0a651/attachment-0001.html>


More information about the gstreamer-devel mailing list