/*------------------------------------------------------------------------------ * Prepare audio device from the name provided previously. *----------------------------------------------------------------------------*/ bool prepareAudioDevice() throw() { if(m_sink != NULL){ gst_object_unref(GST_OBJECT(m_sink)); m_sink=NULL; } GstPad *audiopad; // this constant checks if the audio device configuration contains the string // "/dev", if so the below pipeline definition uses oss. // Perhaps the logic can go three ways and check if the device is labled jack. // Or keep the if-else logic and eliminate OSS as an option as it is obsolete anyway // and ALSA can emulate it. // const bool oss = m_audioDevice.find("/dev") == 0; const bool autosink = m_audioDevice.find("auto") == 0; m_sink = gst_bin_new ("audiobin"); if(m_sink == NULL){ return false; } GstElement *conv = gst_element_factory_make ("audioconvert", "aconv"); audiopad = gst_element_get_pad (conv, "sink"); // set the string to be sent to gstreamer. the option here is to set it to autoaudiosink. GstElement *sink = (autosink ? gst_element_factory_make("autoaudiosink", NULL) : gst_element_factory_make("alsasink", NULL)); if(sink == NULL){ return false; } g_object_set(G_OBJECT(sink), "device", m_audioDevice.c_str(), NULL); m_volume = gst_element_factory_make("volume", NULL); g_object_set(G_OBJECT(m_volume), "volume", 0.0, NULL); gst_bin_add_many (GST_BIN (m_sink), conv, m_volume, sink, NULL); gst_element_link (conv, m_volume); gst_element_link (m_volume, sink); gst_element_add_pad (m_sink, gst_ghost_pad_new ("sink", audiopad)); gst_object_unref (audiopad); return true; }
/*------------------------------------------------------------------------------ * Prepare audio device from the name provided previously. *----------------------------------------------------------------------------*/ bool prepareAudioDevice() throw() { if(m_sink != NULL){ gst_object_unref(GST_OBJECT(m_sink)); m_sink=NULL; } GstPad *audiopad; //gst-launch filesrc location=/root/pepe.mp3 ! mad ! audioconvert ! volume volume=1 ! //lame bitrate=192 ! shout2send ip=127.0.0.1 port=8000 password=mypass mount=test.mp3 m_sink = gst_bin_new ("audiobin"); if(m_sink == NULL){ return false; } GstElement *conv = gst_element_factory_make ("mad", "conv"); GstElement *aconv = gst_element_factory_make ("audioconvert", "aconv"); GstElement *lconv = gst_element_factory_make ("lame", "lconv"); g_object_set(G_OBJECT(lconv), "bitrate", 128, NULL); audiopad = gst_element_get_pad (conv, "sink"); // set the string to be sent to gstreamer. the option here is to set it to autoaudiosink. GstElement *sink = gst_element_factory_make("shout2send", NULL); if(sink == NULL){ return false; } g_object_set(G_OBJECT(sink), "ip", "127.0.0.1", NULL); g_object_set(G_OBJECT(sink), "port", 8000, NULL); g_object_set(G_OBJECT(sink), "password", "mypass", NULL); g_object_set(G_OBJECT(sink), "mount", "vivo", NULL); m_volume = gst_element_factory_make("volume", NULL); g_object_set(G_OBJECT(m_volume), "volume", 0.0, NULL); gst_bin_add_many (GST_BIN (m_sink), conv, aconv, m_volume, lconv, sink, NULL); gst_element_link (conv, aconv); gst_element_link (aconv, m_volume); gst_element_link (m_volume, lconv); gst_element_link (lconv, sink); gst_element_add_pad (m_sink, gst_ghost_pad_new ("sink", audiopad)); gst_object_unref (audiopad); return true; }
--- 1 2010-09-30 04:02:11.000000000 -0300 +++ 2 2010-09-30 04:02:32.000000000 -0300 @@ -9,34 +9,38 @@ GstPad *audiopad; - // this constant checks if the audio device configuration contains the string - // "/dev", if so the below pipeline definition uses oss. - // Perhaps the logic can go three ways and check if the device is labled jack. - // Or keep the if-else logic and eliminate OSS as an option as it is obsolete anyway - // and ALSA can emulate it. - // const bool oss = m_audioDevice.find("/dev") == 0; - const bool autosink = m_audioDevice.find("auto") == 0; + //gst-launch filesrc location=/root/pepe.mp3 ! mad ! audioconvert ! volume volume=1 ! + //lame bitrate=192 ! shout2send ip=127.0.0.1 port=8000 password=mypass mount=test.mp3 m_sink = gst_bin_new ("audiobin"); if(m_sink == NULL){ return false; } - GstElement *conv = gst_element_factory_make ("audioconvert", "aconv"); + GstElement *conv = gst_element_factory_make ("mad", "conv"); + GstElement *aconv = gst_element_factory_make ("audioconvert", "aconv"); + GstElement *lconv = gst_element_factory_make ("lame", "lconv"); + g_object_set(G_OBJECT(lconv), "bitrate", 128, NULL); + audiopad = gst_element_get_pad (conv, "sink"); // set the string to be sent to gstreamer. the option here is to set it to autoaudiosink. - GstElement *sink = (autosink ? gst_element_factory_make("autoaudiosink", NULL) : gst_element_factory_make("alsasink", NULL)); + GstElement *sink = gst_element_factory_make("shout2send", NULL); if(sink == NULL){ return false; } - g_object_set(G_OBJECT(sink), "device", m_audioDevice.c_str(), NULL); - + g_object_set(G_OBJECT(sink), "ip", "127.0.0.1", NULL); + g_object_set(G_OBJECT(sink), "port", 8000, NULL); + g_object_set(G_OBJECT(sink), "password", "mypass", NULL); + g_object_set(G_OBJECT(sink), "mount", "vivo", NULL); + m_volume = gst_element_factory_make("volume", NULL); g_object_set(G_OBJECT(m_volume), "volume", 0.0, NULL); - gst_bin_add_many (GST_BIN (m_sink), conv, m_volume, sink, NULL); - gst_element_link (conv, m_volume); - gst_element_link (m_volume, sink); + gst_bin_add_many (GST_BIN (m_sink), conv, aconv, m_volume, lconv, sink, NULL); + gst_element_link (conv, aconv); + gst_element_link (aconv, m_volume); + gst_element_link (m_volume, lconv); + gst_element_link (lconv, sink); gst_element_add_pad (m_sink, gst_ghost_pad_new ("sink", audiopad)); gst_object_unref (audiopad); return true;
Hello again. I don't know how work this forum or mailing list, but every time I send a message or write directly here on the forum, I not receive my own messages. It is normal?
/*------------------------------------------------------------------------------ * Prepare audio device from the name provided previously. *----------------------------------------------------------------------------*/ bool prepareAudioDevice() throw() { if(m_sink != NULL){ gst_object_unref(GST_OBJECT(m_sink)); m_sink=NULL; } GstPad *audiopad; //gst-launch filesrc location=/root/pepe.mp3 ! audioconvert ! volume volume=1 ! //lame bitrate=192 ! shout2send ip=127.0.0.1 port=8000 password=mypass mount=test.mp3 m_sink = gst_bin_new ("audiobin"); if(m_sink == NULL){ return false; } GstElement *conv = gst_element_factory_make ("audioconvert", "aconv"); GstElement *lconv = gst_element_factory_make ("lame", "lconv"); g_object_set(G_OBJECT(lconv), "bitrate", 128, NULL); audiopad = gst_element_get_static_pad (conv, "sink"); // set the string to be sent to gstreamer. the option here is to set it to autoaudiosink. GstElement *sink = gst_element_factory_make("shout2send", NULL); if(sink == NULL){ return false; } g_object_set(G_OBJECT(sink), "ip", "127.0.0.1", NULL); g_object_set(G_OBJECT(sink), "port", 8000, NULL); g_object_set(G_OBJECT(sink), "password", "mypass", NULL); g_object_set(G_OBJECT(sink), "mount", "vivo", NULL); m_volume = gst_element_factory_make("volume", NULL); g_object_set(G_OBJECT(m_volume), "volume", 0.0, NULL); gst_bin_add_many (GST_BIN (m_sink), conv, m_volume, lconv, sink, NULL); gst_element_link_many (conv, m_volume, lconv, sink); gst_element_add_pad (m_sink, gst_ghost_pad_new ("sink", audiopad)); gst_object_unref (GST_OBJECT (audiopad)); return true; }
gst-inspect shout2send Factory Details: Long name: Icecast network sink Class: Sink/Network Description: Sends data to an icecast server Author(s): Wim Taymans <wim.taymans@chello.be> Pedro Corte-Real <typo@netcabo.pt> Zaheer Abbas Merali <zaheerabbas at merali dot org> Rank: none (0) Plugin Details: Name: shout2send Description: Sends data to an icecast server using libshout2 Filename: /usr/lib/gstreamer-0.10/libgstshout2.so Version: 0.10.9 License: LGPL Source module: gst-plugins-good Binary package: libshout2 Origin URL: http://www.icecast.org/download.html GObject +----GstObject +----GstElement +----GstBaseSink +----GstShout2send Implemented Interfaces: GstTagSetter Pad Templates: SINK template: 'sink' Availability: Always Capabilities: application/ogg audio/mpeg mpegversion: 1 layer: [ 1, 3 ] Element Flags: no flags set Element Implementation: Has change_state() function: gst_base_sink_change_state Has custom save_thyself() function: gst_element_save_thyself Has custom restore_thyself() function: gst_element_restore_thyself Element has no clocking capabilities. Element has no indexing capabilities. Element has no URI handling capabilities. Pads: SINK: 'sink' Implementation: Has chainfunc(): gst_base_sink_chain Has custom eventfunc(): gst_base_sink_event Has bufferallocfunc(): gst_base_sink_pad_buffer_alloc Pad Template: 'sink' Element Properties: name : The name of the object flags: readable, writable String. Default: null Current: "shout2send0" preroll-queue-len : Number of buffers to queue during preroll flags: readable, writable Unsigned Integer. Range: 0 - 4294967295 Default: 0 Current: 0 sync : Sync on the clock flags: readable, writable Boolean. Default: true Current: false max-lateness : Maximum number of nanoseconds that a buffer can be late before it is dropped (-1 unlimited) flags: readable, writable Integer64. Range: -1 - 9223372036854775807 Default: -1 Current: -1 qos : Generate Quality-of-Service events upstream flags: readable, writable Boolean. Default: false Current: false async : Go asynchronously to PAUSED flags: readable, writable Boolean. Default: true Current: true ts-offset : Timestamp offset in nanoseconds flags: readable, writable Integer64. Range: -9223372036854775808 - 9223372036854775807 Default: 0 Current: 0 last-buffer : The last buffer received in the sink flags: readable MiniObject of type "GstBuffer" ip : ip flags: readable, writable String. Default: "127.0.0.1" Current: "127.0.0.1" port : port flags: readable, writable Integer. Range: 1 - 65535 Default: 8000 Current: 8000 password : password flags: readable, writable String. Default: "hackme" Current: "hackme" username : username flags: readable, writable String. Default: "source" Current: "source" streamname : name of the stream flags: readable, writable String. Default: "" Current: "" description : description flags: readable, writable String. Default: "" Current: "" genre : genre flags: readable, writable String. Default: "" Current: "" protocol : Connection Protocol to use flags: readable, writable Enum "GstShout2SendProtocol" Default: 3, "http" Current: 3, "http" (1): xaudiocast - Xaudiocast Protocol (icecast 1.3.x) (2): icy - Icy Protocol (ShoutCast) (3): http - Http Protocol (icecast 2.x) mount : mount flags: readable, writable String. Default: "" Current: "" url : url flags: readable, writable String. Default: "" Current: "" Element Signals: "connection-problem" : void user_function (GstElement* object, gint arg0, gpointer user_data);
It looks like you're new here. If you want to get involved, click one of these buttons!