[gst-devel] filesink content -> outputing in a file

thiagoss thiagossantos at gmail.com
Tue Apr 28 02:32:16 CEST 2009


I suppose you're finishing your application by pressing ctrl-c, I don't know
if wavenc cares about it, but this way you get no eos (if wavenc cares about
it to finish the file, this makes a difference). You might want to set
num-buffers property of audiotestsrc and listen for EOS messages from the
bus and quit the mainloop when it happens.

Btw, what was the problem with gst-launch -e ?

On Mon, Apr 27, 2009 at 7:42 PM, Guilherme <grlongo.ireland at gmail.com>wrote:

> Thiago, I did it before and all I get is a cracked sound.
>
> Pretty weird.
>
> Have a look what I was doing before:
>
>
>
>
> #include<gst/gst.h>
> #include<glib.h>
>
> static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data);
>
> int main(int argc, char *argv[])
> {
>    GMainLoop *loop;
>
>    GstElement *pipeline, *source, *audioconvert, *wavenc, *filesink;
>    GstBus *bus;
>
>    gst_init(&argc, &argv);
>
>    loop = g_main_loop_new (NULL, FALSE);
>
>    /*creating elements*/
>    pipeline     = gst_pipeline_new ("audio-player");
>    source       = gst_element_factory_make ("audiotestsrc",
> "file-source");
>    //audioconvert = gst_element_factory_make ("audioconvert",
> "audio-conversor");
>    wavenc       = gst_element_factory_make ("wavenc",         "wave-enc");
>    filesink     = gst_element_factory_make ("filesink",
> "audio-output");
>
>    if (!pipeline || !source || !audioconvert|| !wavenc || !filesink) {
>        g_printerr ("One element could not be created. Exiting.\n");
>        return -1;
>    }
>
>   * g_object_set (G_OBJECT (filesink), "location", "foo.wav", NULL);*
>
>    /*set-up the pipeline*/
>
>    /*message handler*/
>    bus =  gst_pipeline_get_bus (GST_PIPELINE (pipeline));
>    gst_bus_add_watch (bus, bus_call, loop);
>    gst_object_unref (bus);
>
>    /*colocar todos elementos na pipeline*/
>    gst_bin_add_many (GST_BIN (pipeline), source, wavenc, filesink, NULL);
>
>    /*Linkar elementos*/
>    //gst_element_link ();
>    gst_element_link_many (source, wavenc, filesink, NULL);
>    //g_signal_connect (demuxer, "pad-added", G_CALLBACK (on_pad_added),
> decoder);
>
>    /* set pipeline playing status */
>    g_print ("Running...\n");
>    gst_element_set_state (pipeline, GST_STATE_PLAYING);
>
>    /*iterate*/
>    g_print ("Recording\n");
>    g_main_loop_run (loop);
>
>    /* Out of the main loop, clean up nicely */
>   g_print ("Returned, stopping playback\n");
>   gst_element_set_state (pipeline, GST_STATE_NULL);
>
>    g_print ("Deleting pipeline\n");
>   gst_object_unref (GST_OBJECT (pipeline));
>
>  return 0;
> }
>
> static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data) {
>
>    return TRUE;
> }
>
>
>
>
> ------------------------------------------------------------------------------
> Register Now & Save for Velocity, the Web Performance & Operations
> Conference from O'Reilly Media. Velocity features a full day of
> expert-led, hands-on workshops and two days of sessions from industry
> leaders in dedicated Performance & Operations tracks. Use code vel09scf
> and Save an extra 15% before 5/3. http://p.sf.net/sfu/velocityconf
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>



-- 
Thiago Sousa Santos

Embedded Systems and Pervasive Computing Lab (Embedded)
Center of Electrical Engineering and Informatics (CEEI)
Federal University of Campina Grande (UFCG)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20090427/12c0b072/attachment.htm>


More information about the gstreamer-devel mailing list