[gst-devel] Help for dshowaudiosrc

Julien Isorce julien.isorce at gmail.com
Wed Mar 18 14:04:04 CET 2009


Hi,

2 solutions.

****The first one (user) is to click on volume icone from task bar then
Options->properties then select "Enregistrement" ("Recording") then select
microphone then OK then unmute microphone.

****The second solution (using code), is to recompile dshowaudiosrc using
this patch:
http://bugzilla.gnome.org/show_bug.cgi?id=517203  (just see the last post)

Then the following code could be used to list, select and configure the
input channel of your choise (S/PDIF, lineIn, Mic etc..)

----------------------------- list audio input ------------------------
vector<string> listAudioInputs(const string audioDeviceName)
GstElement* audiodevicesrc = create_element("dshowaudiosrc",
"audiodevicesrc");
 g_object_set(G_OBJECT(audiodevicesrc), "device-name",
audioDeviceName.c_str(), NULL);

 GstPad* pad = gst_element_get_static_pad  (audiodevicesrc, "src");
 gst_pad_get_caps (pad);
 if (pad)
     gst_object_unref(pad);

 vector<string> l_inputs;
 GstMixer *mixer = GST_MIXER (audiodevicesrc);
const GList* list = gst_mixer_list_tracks (mixer);

 for (const GList* item = list; item != NULL; item = item->next)
{
    GstMixerTrack *track = (GstMixerTrack*)item->data;
     l_inputs.push_back(string(track->label));
}

 if (audiodevicesrc)
{
     gst_element_set_state (audiodevicesrc, GST_STATE_NULL);
     gst_object_unref(GST_OBJECT (audiodevicesrc));
}

return l_inputs;
}
------------------------------------------------------------------------------------------------------

---------------------------- select record input and set volume
-------------------------------------
void setAudioInput(const string audioInput, int volumePercentOfMax)
{
  GstMixer *mixer = GST_MIXER (audiodevicesrc);
  GstMixerTrack *track = NULL;
  const GList* list = gst_mixer_list_tracks (mixer);
  for (const GList* item = list; item != NULL; item = item->next)
   {
      GstMixerTrack *track_next = (GstMixerTrack*)item->data;
      if (audioInput == std::string(track_next->label))
           track = track_next;
        else
           //mute other audio inputs
           gst_mixer_set_mute(mixer, track_next, TRUE);
   }
if (track)
{
    vector<gint> volumes(m_audioNbChannels, (gint)(volumePercentOfMax *
track->max_volume / 100.0));
     gst_mixer_set_record (mixer, track, TRUE);
     gst_mixer_set_volume (mixer, track, &volumes[0]);

  }
}

------------------------------------------------------------------------------------------------------

They are some bad things in this code but the idea is there.

You can also use property probe on dshowaudiosrc to list all the audio
device names installed on your system.

J.


2009/3/18 <cammille at polytech.unice.fr>

> Hello,
>
> I'm trying to use dshowaudiosrc on Windows but I have some problems.
>
> For example, I try :
>
> gst-launch-0.10.exe dshowaudiosrc ! audioconvert ! vorbisenc ! oggmux !
> filesink location=foo.ogg
>
> And hen I talk in my micro the file foo.ogg is empty.
> I already verified if my micro functions correctly. It does.
>
> If I try :
> gst-launch-0.10.exe audiotestsrc ! audioconvert ! vorbisenc ! oggmux !
> filesink location=foo.ogg it works !
>
>
> Where is the problem ?
>
>
>
>
>
> ------------------------------------------------------------------------------
> Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
> powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
> easily build your RIAs with Flex Builder, the Eclipse(TM)based development
> software that enables intelligent coding and step-through debugging.
> Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20090318/cfd862c8/attachment.htm>


More information about the gstreamer-devel mailing list