Converting gst launch command into c
Dušan Poizl
poizl at maindata.sk
Wed Nov 26 23:46:54 PST 2014
you need connect to "pad-added" signal and in callback of that signal
you will get GstPad. from this pad you get caps and according to them
you link this pad to additional elements.
Dňa 27.11.2014 o 08:05 Rajesh salumuri napísal(a):
> Hi,
>
> I am trying to convert the following gst-launch command into c:
>
> *gst-launch rtspsrc location=rtsp://ipaddress:port name=demux demux. !
> queue ! decodebin ! autovideosink demux. ! queue ! rtppcmudepay !
> autoaudiosink
>
> *
> I tried the above command it is able to stream both audio and video.*
> *
>
> And I played this rtspurl in vlc media player it is showing the
> properties are as follows:
>
> Type: Video Codec: H264 - MPEG-4 AVC (part 10) (h264) Resolution:
> 320x180 Decoded format: Planar 4:2:0 YUV
>
> Type: Audio Codec: PCM MU-LAW (mlaw) Channels: Mono Sample rate: 8000
> Hz Bits per sample: 8
>
> *I am converting the above gst-launch command in c in brief explained
> below*
>
> pipeline = gst_pipeline_new("nice_pipeline");
> source = gst_element_factory_make("nicesrc","source");//thsi source
> will take the stream from rtsp url
> * demuxer = gst_element_factory_make ("avidemux", "avi-demuxer");*
> decvd= gst_element_factory_make ("decodebin", "decodebin");
> vdsink = gst_element_factory_make ("autovideosink", "video-sink");
> vdqueue = gst_element_factory_make ("queue", "video-queue");
> adqueue = gst_element_factory_make ("queue", "audio-queue");
> decad= gst_element_factory_make ("rtppcmudepay", "rtppcmudepay");
> adsink = gst_element_factory_make ("autoaudiosink", "audio-sink");
>
> bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
> gst_bus_add_watch(bus, bus_call, NULL);
> gst_object_unref (bus);
> gst_bin_add_many(GST_BIN (pipeline), source,decvd,decad,
> adqueue, vdqueue, vdsink, adsink, NULL);
>
> gst_element_link (source, demuxer);
> gst_element_link (decvd, vdqueue);
> gst_element_link (vdqueue, vdsink);
> gst_element_link (decad, adqueue);
> gst_element_link (adqueue, adsink);
>
> g_signal_connect (demuxer, "pad-added", G_CALLBACK
> (on_pad_added), NULL);
> gst_element_set_state(pipeline, GST_STATE_PLAYING);
>
> *on_pad_added func defintion:*
>
> GstCaps *caps;
> GstStructure *str;
>
> caps = gst_pad_get_caps (pad);
> g_assert (caps != NULL);
> str = gst_caps_get_structure (caps, 0);
> g_assert (str != NULL);
>
> if (g_strrstr (gst_structure_get_name (str), "video")) {
> g_debug ("Linking video pad to dec_vd");
>
> GstPad *targetsink = gst_element_get_pad (decvd, "sink");
> g_assert (targetsink != NULL);
> gst_pad_link (pad, targetsink);
> gst_object_unref (targetsink);
> }
>
> if (g_strrstr (gst_structure_get_name (str), "audio")) {
> g_debug ("Linking audio pad to dec_ad");
>
> GstPad *targetsink = gst_element_get_pad (decad, "sink");
> g_assert (targetsink != NULL);
> gst_pad_link (pad, targetsink);
> gst_object_unref (targetsink);
> }
>
> gst_caps_unref (caps);
>
> My question is that what type of demuxer i have to select for the
> properties of video and audio it is streaming.
>
> If any other solution is there for demuxing audio and video from rtsp
> url please suggest or provide some sample code for that.
>
> Thanks.
>
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20141127/109f1c5b/attachment-0001.html>
More information about the gstreamer-devel
mailing list