mirror of
https://github.com/moonlight-stream/moonlight-common-c.git
synced 2025-08-18 09:25:49 +00:00
Separate H.265 video format for SDR and HDR formats
This commit is contained in:
parent
1c386a8987
commit
26fe1cb22c
@ -207,8 +207,8 @@ int getNextFrameInvalidationTuple(PQUEUED_FRAME_INVALIDATION_TUPLE* qfit) {
|
|||||||
void queueFrameInvalidationTuple(int startFrame, int endFrame) {
|
void queueFrameInvalidationTuple(int startFrame, int endFrame) {
|
||||||
LC_ASSERT(startFrame <= endFrame);
|
LC_ASSERT(startFrame <= endFrame);
|
||||||
|
|
||||||
if ((NegotiatedVideoFormat == VIDEO_FORMAT_H264 && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_AVC)) ||
|
if (((NegotiatedVideoFormat & VIDEO_FORMAT_MASK_H264) && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_AVC)) ||
|
||||||
((NegotiatedVideoFormat == VIDEO_FORMAT_H265 && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_HEVC)))) {
|
(((NegotiatedVideoFormat & VIDEO_FORMAT_MASK_H265) && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_HEVC)))) {
|
||||||
PQUEUED_FRAME_INVALIDATION_TUPLE qfit;
|
PQUEUED_FRAME_INVALIDATION_TUPLE qfit;
|
||||||
qfit = malloc(sizeof(*qfit));
|
qfit = malloc(sizeof(*qfit));
|
||||||
if (qfit != NULL) {
|
if (qfit != NULL) {
|
||||||
@ -500,8 +500,8 @@ static void requestInvalidateReferenceFrames(void) {
|
|||||||
long long payload[3];
|
long long payload[3];
|
||||||
PQUEUED_FRAME_INVALIDATION_TUPLE qfit;
|
PQUEUED_FRAME_INVALIDATION_TUPLE qfit;
|
||||||
|
|
||||||
LC_ASSERT((NegotiatedVideoFormat == VIDEO_FORMAT_H264 && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_AVC)) ||
|
LC_ASSERT(((NegotiatedVideoFormat & VIDEO_FORMAT_MASK_H264) && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_AVC)) ||
|
||||||
(NegotiatedVideoFormat == VIDEO_FORMAT_H265 && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_HEVC)));
|
((NegotiatedVideoFormat & VIDEO_FORMAT_MASK_H265) && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_HEVC)));
|
||||||
|
|
||||||
if (!getNextFrameInvalidationTuple(&qfit)) {
|
if (!getNextFrameInvalidationTuple(&qfit)) {
|
||||||
return;
|
return;
|
||||||
|
@ -119,12 +119,20 @@ typedef struct _DECODE_UNIT {
|
|||||||
#define AUDIO_CONFIGURATION_51_SURROUND 1
|
#define AUDIO_CONFIGURATION_51_SURROUND 1
|
||||||
|
|
||||||
// Passed to DecoderRendererSetup to indicate that the following video stream will be
|
// Passed to DecoderRendererSetup to indicate that the following video stream will be
|
||||||
// in H.264 format
|
// in H.264 High Profile.
|
||||||
#define VIDEO_FORMAT_H264 1
|
#define VIDEO_FORMAT_H264 0x0001
|
||||||
|
|
||||||
// Passed to DecoderRendererSetup to indicate that the following video stream will be
|
// Passed to DecoderRendererSetup to indicate that the following video stream will be
|
||||||
// in H.265 format
|
// in H.265 Main profile. This will only be passed if supportsHevc is true.
|
||||||
#define VIDEO_FORMAT_H265 2
|
#define VIDEO_FORMAT_H265 0x0100
|
||||||
|
|
||||||
|
// Passed to DecoderRendererSetup to indicate that the following video stream will be
|
||||||
|
// in H.265 Main10 (HDR10) profile. This will only be passed if enableHdr is true.
|
||||||
|
#define VIDEO_FORMAT_H265_MAIN10 0x0200
|
||||||
|
|
||||||
|
// Masks for clients to use to match video codecs without profile-specific details.
|
||||||
|
#define VIDEO_FORMAT_MASK_H264 0x00FF
|
||||||
|
#define VIDEO_FORMAT_MASK_H265 0xFF00
|
||||||
|
|
||||||
// If set in the renderer capabilities field, this flag will cause audio/video data to
|
// If set in the renderer capabilities field, this flag will cause audio/video data to
|
||||||
// be submitted directly from the receive thread. This should only be specified if the
|
// be submitted directly from the receive thread. This should only be specified if the
|
||||||
|
@ -536,14 +536,19 @@ int performRtspHandshake(void) {
|
|||||||
// format to H264, so we can't just look for the HEVC MIME type. What we'll do instead is
|
// format to H264, so we can't just look for the HEVC MIME type. What we'll do instead is
|
||||||
// look for the base 64 encoded VPS NALU prefix that is unique to the HEVC bitstream.
|
// look for the base 64 encoded VPS NALU prefix that is unique to the HEVC bitstream.
|
||||||
if (StreamConfig.supportsHevc && strstr(response.payload, "sprop-parameter-sets=AAAAAU")) {
|
if (StreamConfig.supportsHevc && strstr(response.payload, "sprop-parameter-sets=AAAAAU")) {
|
||||||
|
if (StreamConfig.enableHdr) {
|
||||||
|
NegotiatedVideoFormat = VIDEO_FORMAT_H265_MAIN10;
|
||||||
|
}
|
||||||
|
else {
|
||||||
NegotiatedVideoFormat = VIDEO_FORMAT_H265;
|
NegotiatedVideoFormat = VIDEO_FORMAT_H265;
|
||||||
|
|
||||||
// Apply bitrate adjustment for SDR HEVC if the client requested one
|
// Apply bitrate adjustment for SDR HEVC if the client requested one
|
||||||
if (StreamConfig.hevcBitratePercentageMultiplier != 0 && !StreamConfig.enableHdr) {
|
if (StreamConfig.hevcBitratePercentageMultiplier != 0) {
|
||||||
StreamConfig.bitrate *= StreamConfig.hevcBitratePercentageMultiplier;
|
StreamConfig.bitrate *= StreamConfig.hevcBitratePercentageMultiplier;
|
||||||
StreamConfig.bitrate /= 100;
|
StreamConfig.bitrate /= 100;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
NegotiatedVideoFormat = VIDEO_FORMAT_H264;
|
NegotiatedVideoFormat = VIDEO_FORMAT_H264;
|
||||||
}
|
}
|
||||||
|
@ -277,7 +277,7 @@ static PSDP_OPTION getAttributesList(char*urlSafeAddr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (AppVersionQuad[0] >= 4) {
|
if (AppVersionQuad[0] >= 4) {
|
||||||
if (NegotiatedVideoFormat == VIDEO_FORMAT_H265) {
|
if (NegotiatedVideoFormat & VIDEO_FORMAT_MASK_H265) {
|
||||||
err |= addAttributeString(&optionHead, "x-nv-clientSupportHevc", "1");
|
err |= addAttributeString(&optionHead, "x-nv-clientSupportHevc", "1");
|
||||||
err |= addAttributeString(&optionHead, "x-nv-vqos[0].bitStreamFormat", "1");
|
err |= addAttributeString(&optionHead, "x-nv-vqos[0].bitStreamFormat", "1");
|
||||||
|
|
||||||
|
@ -44,8 +44,8 @@ void initializeVideoDepacketizer(int pktSize) {
|
|||||||
|
|
||||||
LC_ASSERT(NegotiatedVideoFormat != 0);
|
LC_ASSERT(NegotiatedVideoFormat != 0);
|
||||||
strictIdrFrameWait =
|
strictIdrFrameWait =
|
||||||
!((NegotiatedVideoFormat == VIDEO_FORMAT_H264 && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_AVC)) ||
|
!(((NegotiatedVideoFormat & VIDEO_FORMAT_MASK_H264) && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_AVC)) ||
|
||||||
((NegotiatedVideoFormat == VIDEO_FORMAT_H265 && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_HEVC))));
|
(((NegotiatedVideoFormat & VIDEO_FORMAT_MASK_H265) && (VideoCallbacks.capabilities & CAPABILITY_REFERENCE_FRAME_INVALIDATION_HEVC))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free the NAL chain
|
// Free the NAL chain
|
||||||
|
Loading…
x
Reference in New Issue
Block a user