This adds a check to change the capture settings to use 2 channels when
a channel number is encountered that would otherwise be interpreted as
SPEAKERS_UNKNOWN.
If the sample format used by PulseAudio can not be converted into an
OBS audio format it will be handled as AUDIO_FORMAT_UNKNOWN which will
not result in a proper audio recording. So instead we request a format
that OBS supports from PulseAudio and let it do the format conversion.
The format PA_SAMPLE_S24_32LE is a 24 bit audio format in 32 bit integers
and not a 32 bit audio format and so it should no be mapped to
AUDIO_FORMAT_32BIT.
Before it was giving timestamps based upon system time for each new
segment of audio data. Also, it was subtracting pulse latency from the
audio timestamp, which seems like it was really meant for use with the
pulse audio time rather than system time.
Now, it just uses system time for timestamps. Still might not be
totally perfect, but seems to be much better than it was.
This also removes the latency calculation. Latency is no longer used
because we're not using pulseaudio timing.
Typedef pointers are unsafe. If you do:
typedef struct bla *bla_t;
then you cannot use it as a constant, such as: const bla_t, because
that constant will be to the pointer itself rather than to the
underlying data. I admit this was a fundamental mistake that must
be corrected.
All typedefs that were pointer types will now have their pointers
removed from the type itself, and the pointers will be used when they
are actually used as variables/parameters/returns instead.
This does not break ABI though, which is pretty nice.
When setting up the capture, the plugin will now query pulse for the default
format of the specific source instead of the server.
This is useful if a source has different settings than what the defaults are
for the server, e.g. when the source is an output with 5.1 surround sound
and the microphone input is mono while the server defaults to stereo sound.
This fixes a bug where the pulseaudio plugin always reported
a speaker layout of stereo to obs, regardless of how many channels
pulseaudio actually recorded.
If the default number of channels was different to 2 this would
cause audio distortion.
The locale parameter was a mistake, because it puts extra needless
burden upon the module developer to have to handle this variable for
each and every single callback function. The parameter is being removed
in favor of a single centralized module callback function that
specifically updates locale information for a module only when needed.
Having the value stored here is somewhat pointless, so this is one step
in fixing the locale handling. Locale should be handled by the modules
themselves with their own loaded locale lookup information.
With this option enabled the plugin will generate timestamps
based on the system time instead of using the ones provided by
pulse audio. This might fix problems with audio desync and may
become the default/only option in the future.
The defaults functions will now return the default device for the
input/output as provided by pulseaudio.
The default output device is the monitor of the default sink.
The wrapping library uses a global mainloop and context which
allows operations to share the connection. The global mainloop
is created and destroyed based on internal reference counting.
The capture code won't spawn a new thread for each input anymore
but instead just create the recording stream and rely on the
threaded mainloop to execute the read callback when data is available.
Improve the properties API so that it can actually respond somewhat to
user input. Maybe later this might be further improved or replaced with
something script-based.
When creating a property, you can now add a callback to that property
that notifies when the property has been changed in the user interface.
Return true if you want the properties to be refreshed, or false if not.
Though now that I think about it I doubt there would ever be a case
where you would have this callback and *not* refresh the properties.
Regardless, this allows functions to change the values of properties or
settings, or enable/disable/hide other property controls from view
dynamically.