Add color space and color range options

This commit is contained in:
Cameron Gutman 2019-12-14 14:32:47 -08:00
parent b0213d06a7
commit e60a7ef75f
2 changed files with 23 additions and 0 deletions

View File

@ -18,6 +18,16 @@ extern "C" {
#define STREAM_CFG_REMOTE 1
#define STREAM_CFG_AUTO 2
// Values for the 'colorSpace' field below.
// Rec. 2020 is only supported with HEVC video streams.
#define COLORSPACE_REC_601 0
#define COLORSPACE_REC_709 1
#define COLORSPACE_REC_2020 2
// Values for the 'colorRange' field below
#define COLOR_RANGE_LIMITED 0
#define COLOR_RANGE_FULL 1
typedef struct _STREAM_CONFIGURATION {
// Dimensions in pixels of the desired video stream
int width;
@ -68,6 +78,14 @@ typedef struct _STREAM_CONFIGURATION {
// of GFE for enhanced frame pacing.
int clientRefreshRateX100;
// If specified, sets the encoder colorspace to the provided COLORSPACE_*
// option (listed above). If not set, the encoder will default to Rec 601.
int colorSpace;
// If specified, sets the encoder color range to the provided COLOR_RANGE_*
// option (listed above). If not set, the encoder will default to Limited.
int colorRange;
// AES encryption data for the remote input stream. This must be
// the same as what was passed as rikey and rikeyid
// in /launch and /resume requests.

View File

@ -393,6 +393,11 @@ static PSDP_OPTION getAttributesList(char*urlSafeAddr) {
AudioPacketDuration = 5;
}
if (AppVersionQuad[0] >= 7) {
sprintf(payloadStr, "%d", (StreamConfig.colorSpace << 1) | StreamConfig.colorRange);
err |= addAttributeString(&optionHead, "x-nv-video[0].encoderCscMode", payloadStr);
}
if (err == 0) {
return optionHead;
}