Re: How to distinguish between different session(audio and video)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: How to distinguish between different session(audio and video)

shuyufu
Hi,

May be you can get the pad caps to see it's audio or video pad.

static void on_pad_added (GstElement *element, GstPad *pad, gpointer  data)
{
    GstCaps *caps = NULL;
    GstStructure *structure = NULL;

    caps = gst_pad_get_caps (pad);
    structure = gst_caps_get_structure (caps, 0);
    media_type = g_strdup (gst_structure_get_string (structure, "media"));
    structure = NULL;
    gst_caps_unref (caps);
    caps = NULL;

    if (0 == g_strcmp0 ("audio", media_type))
    {
        // audio stuff
    }
    else if (0 == g_strcmp0 ("video", media_type))
    {
        // video stuff
    }
    else
    {
        // not supported media type
    }

    g_free (media_type);
}
2011/8/1 arpi d <[hidden email]>
I am writing client code which receives audio+video.

When I am trying to connect rtpbin and depayloader how to know which session is this?

Actually,I am writing the code in C and am trying to use g_signal_connect.
So that I can use 
 g_signal_connect (rtpbin, "pad-added", G_CALLBACK (pad_added_cb), videodepay);

 g_signal_connect (rtpbin, "pad-added", G_CALLBACK (pad_added_cb), audiodepay); using if -else condition but for that I need to find out the session how I can do?


my client pipeline is:

VIDEO_DEC="rtph264depay ! ffdec_h264"
AUDIO_DEC="rtpmp4gdepay ! faad"

VIDEO_SINK="ffmpegcolorspace ! autovideosink"
AUDIO_SINK="autoaudiosink"
DEST=127.0.0.1

LATENCY=100

gst-launch -v gstrtpbin name=rtpbin                   \
    udpsrc caps=$VIDEO_CAPS port=5000 ! rtpbin.recv_rtp_sink_0         \
      rtpbin. ! $VIDEO_DEC ! $VIDEO_SINK                               \
    udpsrc port=5001 ! rtpbin.recv_rtcp_sink_0                         \
 rtpbin.send_rtcp_src_0 ! udpsink port=5005 host=$DEST sync=false async=false
udpsrc caps=$AUDIO_CAPS port=5002 ! rtpbin.recv_rtp_sink_1              \
rtpbin. ! $AUDIO_DEC ! $AUDIO_SINK                                \
udpsrc port=5003 ! rtpbin.recv_rtcp_sink_1                              \
rtpbin.send_rtcp_src_1 ! udpsink port=5007 host=$DEST sync=false async=false
 
Same thing in C language ,please reply.
Please reply.
If you know other way please do let  me know.
Thaks in advance.

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




--
Sincerely,
Bobby

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel