From 99f22fa7e9208159cef663394cf47e230ecb3d46 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Thu, 2 Apr 2020 18:41:32 -0700 Subject: [PATCH] Undeprecate AUDIO_CONFIGURATION values and add a new macro for converting AUDIO_CONFIGURATION into launch/resume parameters --- src/Limelight.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Limelight.h b/src/Limelight.h index dd54faa..aaf844a 100644 --- a/src/Limelight.h +++ b/src/Limelight.h @@ -52,7 +52,7 @@ typedef struct _STREAM_CONFIGURATION { int streamingRemotely; // Specifies the channel configuration of the audio stream. - // See MAKE_AUDIO_CONFIGURATION() below. + // See AUDIO_CONFIGURATION constants and MAKE_AUDIO_CONFIGURATION() below. int audioConfiguration; // Specifies that the client can accept an H.265 video stream @@ -153,14 +153,13 @@ typedef struct _DECODE_UNIT { } DECODE_UNIT, *PDECODE_UNIT; // Specifies that the audio stream should be encoded in stereo (default) -// Deprecated: use MAKE_AUDIO_CONFIGURATION() instead! #define AUDIO_CONFIGURATION_STEREO MAKE_AUDIO_CONFIGURATION(2, 0x3) // Specifies that the audio stream should be in 5.1 surround sound if the PC is able -// Deprecated: use MAKE_AUDIO_CONFIGURATION() instead! #define AUDIO_CONFIGURATION_51_SURROUND MAKE_AUDIO_CONFIGURATION(6, 0xFC) // Specifies an audio configuration by channel count and channel mask +// NOTE: Not all combinations are supported by GFE and/or this library. #define MAKE_AUDIO_CONFIGURATION(channelCount, channelMask) \ (((channelMask) << 16) | (channelCount << 8) | 0xCA) @@ -168,6 +167,11 @@ typedef struct _DECODE_UNIT { #define CHANNEL_COUNT_FROM_AUDIO_CONFIGURATION(x) (((x) >> 8) & 0xFF) #define CHANNEL_MASK_FROM_AUDIO_CONFIGURATION(x) (((x) >> 16) & 0xFF) +// Helper macro to retreive the surroundAudioInfo parameter value that must be passed in +// the /launch and /resume HTTPS requests when starting the session. +#define SURROUNDAUDIOINFO_FROM_AUDIO_CONFIGURATION(x) \ + (CHANNEL_MASK_FROM_AUDIO_CONFIGURATION(x) << 16 | CHANNEL_COUNT_FROM_AUDIO_CONFIGURATION(x)) + // The maximum number of channels supported #define AUDIO_CONFIGURATION_MAX_CHANNEL_COUNT 6