Lennart Poettering wrote: > On Mon, 16.03.09 20:14, Magnus Hjorth (magnus.hjorth at home.se) wrote: > > >> Hi, >> >> I'm trying to find a way in libpulse to query the sample format of the >> default source. Passing NULL to pa_context_get_source_info_by_name does >> not seem to work ("invalid argument"). >> > Hmm, why would you want to query this? Smells like you are working on > some racy code. > I'm aware that this is racy, and a check again after recording has started (using pa_stream_get_index and pa_context_get_source_info) is needed to verify that that this hasn't changed. What I'm doing is, I'm writing a PulseAudio driver for my sound file editor, and for recording I want to do the following: - Get a list of supported recording format(s) before recording starts. This is what the above is for. - Start recording with one of the supported formats. At this point, a check that the supported format hasn't changed is made. - Make sure as far as possible that the format corresponds to the actual format of the input, so we're not actually recording 8 kHz mono when we think we're recording in high quality, for example. > Try passing "@DEFAULT_SOURCE@" as sink name in pa_context_get_source_info_by_name(). > Thanks. Best regards, Magnus