win-dshow: Add audio output mode options
This allows the ability to output the audio of the device as desktop audio (via the WaveOut or DirectSound audio renderers) instead of capturing the audio only. In the future, we'll implement audio monitoring which will make this feature obsolete, but for the time being I decided to add this option as a temporary measure to allow users to play the audio from their devices via the DirectShow output.
This commit is contained in:
@@ -18,6 +18,10 @@ Resolution="Resolution"
|
||||
VideoFormat="Video Format"
|
||||
VideoFormat.Any="Any"
|
||||
VideoFormat.Unknown="Unknown (%1)"
|
||||
AudioOutputMode="Audio Output Mode"
|
||||
AudioOutputMode.Capture="Capture audio only"
|
||||
AudioOutputMode.DirectSound="Output desktop audio (DirectSound)"
|
||||
AudioOutputMode.WaveOut="Output desktop audio (WaveOut)"
|
||||
UseCustomAudioDevice="Use custom audio device"
|
||||
AudioDevice="Audio Device"
|
||||
Buffering="Buffering"
|
||||
|
@@ -38,6 +38,7 @@ using namespace DShow;
|
||||
#define LAST_RESOLUTION "last_resolution"
|
||||
#define BUFFERING_VAL "buffering"
|
||||
#define FLIP_IMAGE "flip_vertically"
|
||||
#define AUDIO_OUTPUT_MODE "audio_output_mode"
|
||||
#define USE_CUSTOM_AUDIO "use_custom_audio_device"
|
||||
#define AUDIO_DEVICE_ID "audio_device_id"
|
||||
#define COLOR_SPACE "color_space"
|
||||
@@ -60,6 +61,10 @@ using namespace DShow;
|
||||
#define TEXT_BUFFERING_ON obs_module_text("Buffering.Enable")
|
||||
#define TEXT_BUFFERING_OFF obs_module_text("Buffering.Disable")
|
||||
#define TEXT_FLIP_IMAGE obs_module_text("FlipVertically")
|
||||
#define TEXT_AUDIO_MODE obs_module_text("AudioOutputMode")
|
||||
#define TEXT_MODE_CAPTURE obs_module_text("AudioOutputMode.Capture")
|
||||
#define TEXT_MODE_DSOUND obs_module_text("AudioOutputMode.DirectSound")
|
||||
#define TEXT_MODE_WAVEOUT obs_module_text("AudioOutputMode.WaveOut")
|
||||
#define TEXT_CUSTOM_AUDIO obs_module_text("UseCustomAudioDevice")
|
||||
#define TEXT_AUDIO_DEVICE obs_module_text("AudioDevice")
|
||||
#define TEXT_ACTIVATE obs_module_text("Activate")
|
||||
@@ -840,6 +845,9 @@ bool DShowInput::UpdateAudioConfig(obs_data_t *settings)
|
||||
placeholders::_3, placeholders::_4,
|
||||
placeholders::_5);
|
||||
|
||||
audioConfig.mode =
|
||||
(AudioMode)obs_data_get_int(settings, AUDIO_OUTPUT_MODE);
|
||||
|
||||
return device.SetAudioConfig(&audioConfig);
|
||||
}
|
||||
|
||||
@@ -960,6 +968,8 @@ static void GetDShowDefaults(obs_data_t *settings)
|
||||
obs_data_set_default_bool(settings, "active", true);
|
||||
obs_data_set_default_string(settings, COLOR_SPACE, "default");
|
||||
obs_data_set_default_string(settings, COLOR_RANGE, "partial");
|
||||
obs_data_set_default_int(settings, AUDIO_OUTPUT_MODE,
|
||||
(int)AudioMode::Capture);
|
||||
}
|
||||
|
||||
struct Resolution {
|
||||
@@ -1704,6 +1714,15 @@ static obs_properties_t *GetDShowProperties(void *obj)
|
||||
if (!data->audioDevices.size())
|
||||
return ppts;
|
||||
|
||||
p = obs_properties_add_list(ppts, AUDIO_OUTPUT_MODE, TEXT_AUDIO_MODE,
|
||||
OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_INT);
|
||||
obs_property_list_add_int(p, TEXT_MODE_CAPTURE,
|
||||
(int64_t)AudioMode::Capture);
|
||||
obs_property_list_add_int(p, TEXT_MODE_DSOUND,
|
||||
(int64_t)AudioMode::DirectSound);
|
||||
obs_property_list_add_int(p, TEXT_MODE_WAVEOUT,
|
||||
(int64_t)AudioMode::WaveOut);
|
||||
|
||||
p = obs_properties_add_bool(ppts, USE_CUSTOM_AUDIO, TEXT_CUSTOM_AUDIO);
|
||||
|
||||
obs_property_set_modified_callback(p, CustomAudioClicked);
|
||||
|
Reference in New Issue
Block a user