HELP: how to using c to implement this ?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

HELP: how to using c to implement this ?

Freeman Zhang
HI ,

I'm using command line:
gst-launch filesrc location=recordSample ! audio/x-alaw, channels=1, rate=8000 ! alawdec ! autoaudiosink
to play a raw G711 file, it works.

But I don't know which GstElement shall I use with "audio/x-alaw, channels=1, rate=8000", is it "capsfiler"?

Please give me a hand.

Thanks


Freeman 

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: HELP: how to using c to implement this ?

Kapil Agrawal
You might want to try
gst_element_link_filtered ()


-kapil

On Wed, Nov 4, 2009 at 2:57 PM, Freeman Zhang <[hidden email]> wrote:
HI ,

I'm using command line:
gst-launch filesrc location=recordSample ! audio/x-alaw, channels=1, rate=8000 ! alawdec ! autoaudiosink
to play a raw G711 file, it works.

But I don't know which GstElement shall I use with "audio/x-alaw, channels=1, rate=8000", is it "capsfiler"?

Please give me a hand.

Thanks


Freeman 

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel




--
http://www.linkedin.com/in/kapilagrawal

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: HELP: how to using c to implement this ?

Freeman Zhang
Is it in this way?

                GstElement* filesrc = gst_element_factory_make("filesrc", "filesrc");
                  g_object_set(G_OBJECT(filesrc), "location", cmd->filename, NULL);

GstCaps *caps = gst_caps_from_string("audio/x-alaw, channels=1, rate=8000");
g_assert(caps != NULL);
decoder = gst_element_factory_make("alawdec", "decoder");
res = gst_element_link_filtered (filesrc, decoder, caps);
g_assert(res == TRUE);
                         
                        
But it return:
                         gst_element_link_pads_filtered: assertion `GST_IS_BIN (parent)' failed


Thanks

2009/11/4 Kapil Agrawal <[hidden email]>
You might want to try
gst_element_link_filtered ()


-kapil

On Wed, Nov 4, 2009 at 2:57 PM, Freeman Zhang <[hidden email]> wrote:
HI ,

I'm using command line:
gst-launch filesrc location=recordSample ! audio/x-alaw, channels=1, rate=8000 ! alawdec ! autoaudiosink
to play a raw G711 file, it works.

But I don't know which GstElement shall I use with "audio/x-alaw, channels=1, rate=8000", is it "capsfiler"?

Please give me a hand.

Thanks


Freeman 

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel




--
http://www.linkedin.com/in/kapilagrawal

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: HELP: how to using c to implement this ?

Tim-Philipp Müller-2
On Wed, 2009-11-04 at 18:02 +0800, Freeman Zhang wrote:

> decoder = gst_element_factory_make("alawdec", "decoder");
> res = gst_element_link_filtered (filesrc, decoder, caps);
> g_assert(res == TRUE);
>                                                  
> But it return:
>                          gst_element_link_pads_filtered: assertion
> `GST_IS_BIN (parent)' failed

You need to add elements to a pipeline/bin before linking them.

Cheers
 -Tim





------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: HELP: how to using c to implement this ?

Freeman Zhang
Get it.

Thank you very much.

2009/11/4 Tim-Philipp Müller <[hidden email]>
On Wed, 2009-11-04 at 18:02 +0800, Freeman Zhang wrote:

> decoder = gst_element_factory_make("alawdec", "decoder");
> res = gst_element_link_filtered (filesrc, decoder, caps);
> g_assert(res == TRUE);
>
> But it return:
>                          gst_element_link_pads_filtered: assertion
> `GST_IS_BIN (parent)' failed

You need to add elements to a pipeline/bin before linking them.

Cheers
 -Tim





------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: HELP: how to using c to implement this ?

Freeman Zhang
Well, for simplify my work.

I'm using gst_parse_launch to create the pipeline:

gchar str[200];
sprintf(str, "filesrc location=./media/%s" \
"! audio/x-alaw, channels=1, rate=8000" \
"! alawdec ! autoaudiosink", cmd->filename);
 
GError* err = NULL;
pipeline = gst_parse_launch(str, &err);
g_assert(pipeline != NULL);

                      // Play
                g_print("Playing.");
                gst_element_set_state (pipeline, GST_STATE_PLAYING);
                g_loop = g_main_loop_new (NULL, FALSE);
                g_main_loop_run (g_loop);
                gst_element_set_state (pipeline, GST_STATE_NULL);
                g_print("Stopped\n");

But no sound output,  I tried at command-line, it works.  What's the problem?

Thanks




2009/11/4 Freeman Zhang <[hidden email]>
Get it.

Thank you very much.

2009/11/4 Tim-Philipp Müller <[hidden email]>

On Wed, 2009-11-04 at 18:02 +0800, Freeman Zhang wrote:

> decoder = gst_element_factory_make("alawdec", "decoder");
> res = gst_element_link_filtered (filesrc, decoder, caps);
> g_assert(res == TRUE);
>
> But it return:
>                          gst_element_link_pads_filtered: assertion
> `GST_IS_BIN (parent)' failed

You need to add elements to a pipeline/bin before linking them.

Cheers
 -Tim





------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gstreamer-devel