[gst-devel] Creating multiple sinks
Pavan Kumar Patale
pavanpatale at hotmail.com
Thu Aug 10 19:29:55 CEST 2006
Hi,
I tried to do that but still i am unable to get the result. The code is as
follows. Could you pls let me know if the usage is right ?
Thanks,
Pavan.
#include<glib.h>
#include<gst/gst.h>
#include<signal.h>
GstElement *pipeline = NULL;
GMainLoop *loop;
void handle()
{
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (pipeline));
g_main_loop_quit(loop);
}
/**
* This is the Main function for this application.
* */
gint
main (int argc, char *argv[])
{
GstElement *src = NULL;
GstElement *defaultsink = NULL;
GstElement *filesink = NULL;
GstElement *telement = NULL;
if (argc != 2) {
g_print ("Usage: %s <filename>\n", argv[0]);
return -1;
}
gst_init(&argc,&argv);
loop = g_main_loop_new(NULL, FALSE);
pipeline = gst_pipeline_new("record-pipeline");
src = gst_element_factory_make ("dsppcmsrc", "my_recordsource");
if(src==NULL)
{
g_print("Unable to create the source element\n");
return -1;
}
gst_bin_add(GST_BIN(pipeline),src);
telement = gst_element_factory_make("tee","telement");
if(telement == NULL)
{
g_print("Unable to create the tee element\n");
return -1;
}
gst_bin_add(GST_BIN(pipeline),telement);
defaultsink = gst_element_factory_make ("dsppcmsink", "speaker");
if(defaultsink==NULL)
{
g_print("Unable to create the default sink element\n");
return -1;
}
gst_bin_add(GST_BIN(pipeline),defaultsink);
GstPad *pad = NULL;
pad = gst_element_get_request_pad(telement,"src%d");
g_print("new-pad %s\n",gst_pad_get_name(pad));
if(!gst_element_link_pads(telement,gst_pad_get_name(pad),
defaultsink,
gst_pad_get_name(gst_element_get_pad(defaultsink,"sink")
)))
{
g_print("Unable to link tee and speaker \n");
}
filesink = gst_element_factory_make ("filesink", "filesink");
if(filesink==NULL)
{
g_print("Unable to create the file sink element\n");
return -1;
}
gst_bin_add(GST_BIN(pipeline),filesink);
g_object_set(G_OBJECT(filesink),"location",argv[1],NULL);
if(!gst_element_link_pads(telement,gst_pad_get_name(pad),
filesink,
gst_pad_get_name(gst_element_get_pad(filesink,"sink"))))
{
g_print("Unable to link tee and file sink\n");
}
gst_element_link_many(src,telement,NULL);
gst_element_set_state (pipeline, GST_STATE_PLAYING);
signal(SIGINT,handle);
g_main_loop_run (loop);
return 0;
}
>From: Benoit Fouet <benoit.fouet at purplelabs.com>
>To: Pavan Kumar Patale <pavanpatale at hotmail.com>
>CC: gstreamer-devel at lists.sourceforge.net
>Subject: Re: [gst-devel] Creating multiple sinks
>Date: Wed, 09 Aug 2006 09:41:19 +0200
>MIME-Version: 1.0
>Received: from athena.purplelabs.com ([212.11.31.196]) by
>bay0-mc8-f4.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.2444); Wed, 9
>Aug 2006 00:41:26 -0700
>Received: from localhost (localhost [127.0.0.1])by athena.purplelabs.com
>(Postfix) with ESMTP id 8C7FC188B1;Wed, 9 Aug 2006 09:41:26 +0200 (CEST)
>Received: from athena.purplelabs.com ([127.0.0.1]) by localhost
>(athena.purplelabs.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id
>32331-13; Wed, 9 Aug 2006 09:41:23 +0200 (CEST)
>Received: from [10.1.2.69] (mmedia_bfo_lin.purplelabs.com [10.1.2.69])by
>athena.purplelabs.com (Postfix) with ESMTP id 833ED18280;Wed, 9 Aug 2006
>09:41:23 +0200 (CEST)
>X-Message-Info: LsUYwwHHNt3OxLKZut2mwbB/5w7+V/g5IRKbsuD/+lI=
>User-Agent: Mozilla Thunderbird 1.0.7 (X11/20050923)
>X-Accept-Language: en-us, en
>References: <BAY122-F189DE5A9705163EEA22DB4AA550 at phx.gbl>
>X-Enigmail-Version: 0.91.0.0
>X-Virus-Scanned: amavisd-new at purplelabs.com
>Return-Path: benoit.fouet at purplelabs.com
>X-OriginalArrivalTime: 09 Aug 2006 07:41:26.0545 (UTC)
>FILETIME=[3841C010:01C6BB87]
>
>hello,
>
>Pavan Kumar Patale wrote:
>
> >Hi,
> >
> >I have a requirement to record RTP stream of data which is being sent to
> >speaker.
> >I am able to redirect the stream to a file by creating a filesink.
> >
> >Can some one pls let me know if it is possible to create multiple sinks
>i.e.
> >i should
> >be able to hear on the speaker as well as store the data to file.
> >
> >
> >
>maybe using a tee element should help.
>you could then plug your two sinks after it :)
>
>Hope that helps
>
>-- Ben
>
> >Thanks,
> >Pavan.
> >
> >
> >
> >-------------------------------------------------------------------------
> >Using Tomcat but need to do more? Need to support web services, security?
> >Get stuff done quickly with pre-integrated technology to make your job
>easier
> >Download IBM WebSphere Application Server v.1.0.1 based on Apache
>Geronimo
> >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> >_______________________________________________
> >gstreamer-devel mailing list
> >gstreamer-devel at lists.sourceforge.net
> >https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
> >
> >
More information about the gstreamer-devel
mailing list