mirror of
https://github.com/moonlight-stream/moonlight-embedded.git
synced 2025-07-01 15:25:35 +00:00
Implement foundation for HDR support
Likely not functional for any decoder yet
This commit is contained in:
parent
28ace51874
commit
c2f21b955d
@ -742,7 +742,9 @@ int gs_start_app(PSERVER_DATA server, STREAM_CONFIGURATION *config, int appId, b
|
||||
// used to use 60 here but that locked the frame rate to 60 FPS
|
||||
// on GFE 3.20.3.
|
||||
int fps = config->fps > 60 ? 0 : config->fps;
|
||||
snprintf(url, sizeof(url), "https://%s:%u/launch?uniqueid=%s&uuid=%s&appid=%d&mode=%dx%dx%d&additionalStates=1&sops=%d&rikey=%s&rikeyid=%d&localAudioPlayMode=%d&surroundAudioInfo=%d&remoteControllersBitmap=%d&gcmap=%d", server->serverInfo.address, server->httpsPort, unique_id, uuid_str, appId, config->width, config->height, fps, sops, rikey_hex, rikeyid, localaudio, surround_info, gamepad_mask, gamepad_mask);
|
||||
snprintf(url, sizeof(url), "https://%s:%u/launch?uniqueid=%s&uuid=%s&appid=%d&mode=%dx%dx%d&additionalStates=1&sops=%d&rikey=%s&rikeyid=%d&localAudioPlayMode=%d&surroundAudioInfo=%d&remoteControllersBitmap=%d&gcmap=%d%s",
|
||||
server->serverInfo.address, server->httpsPort, unique_id, uuid_str, appId, config->width, config->height, fps, sops, rikey_hex, rikeyid, localaudio, surround_info, gamepad_mask, gamepad_mask,
|
||||
config->enableHdr ? "&hdrMode=1&clientHdrCapVersion=0&clientHdrCapSupportedFlagsInUint32=0&clientHdrCapMetaDataId=NV_STATIC_METADATA_TYPE_1&clientHdrCapDisplayData=0x0x0x0x0x0x0x0x0x0x0" : "");
|
||||
} else
|
||||
snprintf(url, sizeof(url), "https://%s:%u/resume?uniqueid=%s&uuid=%s&rikey=%s&rikeyid=%d&surroundAudioInfo=%d", server->serverInfo.address, server->httpsPort, unique_id, uuid_str, rikey_hex, rikeyid, surround_info);
|
||||
|
||||
|
@ -74,6 +74,7 @@ static struct option long_options[] = {
|
||||
{"nomouseemulation", no_argument, NULL, '4'},
|
||||
{"pin", required_argument, NULL, '5'},
|
||||
{"port", required_argument, NULL, '6'},
|
||||
{"hdr", no_argument, NULL, '7'},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
||||
@ -252,6 +253,9 @@ static void parse_argument(int c, char* value, PCONFIGURATION config) {
|
||||
case '6':
|
||||
config->port = atoi(value);
|
||||
break;
|
||||
case '7':
|
||||
config->stream.enableHdr = true;
|
||||
break;
|
||||
case 1:
|
||||
if (config->action == NULL)
|
||||
config->action = value;
|
||||
|
@ -202,6 +202,7 @@ static void help() {
|
||||
printf("\t-bitrate <bitrate>\tSpecify the bitrate in Kbps\n");
|
||||
printf("\t-packetsize <size>\tSpecify the maximum packetsize in bytes\n");
|
||||
printf("\t-codec <codec>\t\tSelect used codec: auto/h264/h265 (default auto)\n");
|
||||
printf("\t-hdr\t\tEnable HDR streaming (experimental, requires host and device support)\n");
|
||||
printf("\t-remote <yes/no/auto>\t\t\tEnable optimizations for WAN streaming (default auto)\n");
|
||||
printf("\t-app <app>\t\tName of app to stream\n");
|
||||
printf("\t-nosops\t\t\tDon't allow GFE to modify game settings\n");
|
||||
@ -316,6 +317,10 @@ int main(int argc, char* argv[]) {
|
||||
exit(-1);
|
||||
}
|
||||
config.stream.supportsHevc = config.codec != CODEC_H264 && (config.codec == CODEC_HEVC || platform_supports_hevc(system));
|
||||
if (config.stream.enableHdr && !config.stream.supportsHevc) {
|
||||
fprintf(stderr, "HDR streaming requires HEVC codec\n");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
if (system == SDL)
|
||||
|
@ -42,31 +42,28 @@ int aml_setup(int videoFormat, int width, int height, int redrawRate, void* cont
|
||||
codecParam.noblock = 0;
|
||||
codecParam.am_sysinfo.param = 0;
|
||||
|
||||
switch (videoFormat) {
|
||||
case VIDEO_FORMAT_H264:
|
||||
if (width > 1920 || height > 1080) {
|
||||
codecParam.video_type = VFORMAT_H264_4K2K;
|
||||
codecParam.am_sysinfo.format = VIDEO_DEC_FORMAT_H264_4K2K;
|
||||
} else {
|
||||
codecParam.video_type = VFORMAT_H264;
|
||||
codecParam.am_sysinfo.format = VIDEO_DEC_FORMAT_H264;
|
||||
if (videoFormat & VIDEO_FORMAT_MASK_H264) {
|
||||
if (width > 1920 || height > 1080) {
|
||||
codecParam.video_type = VFORMAT_H264_4K2K;
|
||||
codecParam.am_sysinfo.format = VIDEO_DEC_FORMAT_H264_4K2K;
|
||||
} else {
|
||||
codecParam.video_type = VFORMAT_H264;
|
||||
codecParam.am_sysinfo.format = VIDEO_DEC_FORMAT_H264;
|
||||
|
||||
// Workaround for decoding special case of C1, 1080p, H264
|
||||
int major, minor;
|
||||
struct utsname name;
|
||||
uname(&name);
|
||||
int ret = sscanf(name.release, "%d.%d", &major, &minor);
|
||||
if (!(major > 3 || (major == 3 && minor >= 14)) && width == 1920 && height == 1080)
|
||||
codecParam.am_sysinfo.param = (void*) UCODE_IP_ONLY_PARAM;
|
||||
}
|
||||
break;
|
||||
case VIDEO_FORMAT_H265:
|
||||
codecParam.video_type = VFORMAT_HEVC;
|
||||
codecParam.am_sysinfo.format = VIDEO_DEC_FORMAT_HEVC;
|
||||
break;
|
||||
default:
|
||||
printf("Video format not supported\n");
|
||||
return -1;
|
||||
// Workaround for decoding special case of C1, 1080p, H264
|
||||
int major, minor;
|
||||
struct utsname name;
|
||||
uname(&name);
|
||||
int ret = sscanf(name.release, "%d.%d", &major, &minor);
|
||||
if (!(major > 3 || (major == 3 && minor >= 14)) && width == 1920 && height == 1080)
|
||||
codecParam.am_sysinfo.param = (void*) UCODE_IP_ONLY_PARAM;
|
||||
}
|
||||
} else if (videoFormat & VIDEO_FORMAT_MASK_H265) {
|
||||
codecParam.video_type = VFORMAT_HEVC;
|
||||
codecParam.am_sysinfo.format = VIDEO_DEC_FORMAT_HEVC;
|
||||
} else {
|
||||
printf("Video format not supported\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
codecParam.am_sysinfo.width = width;
|
||||
|
@ -60,13 +60,13 @@ int ffmpeg_init(int videoFormat, int width, int height, int perf_lvl, int buffer
|
||||
}
|
||||
|
||||
ffmpeg_decoder = perf_lvl & VAAPI_ACCELERATION ? VAAPI : SOFTWARE;
|
||||
switch (videoFormat) {
|
||||
case VIDEO_FORMAT_H264:
|
||||
decoder = avcodec_find_decoder_by_name("h264");
|
||||
break;
|
||||
case VIDEO_FORMAT_H265:
|
||||
decoder = avcodec_find_decoder_by_name("hevc");
|
||||
break;
|
||||
if (videoFormat & VIDEO_FORMAT_MASK_H264) {
|
||||
decoder = avcodec_find_decoder_by_name("h264");
|
||||
} else if (videoFormat & VIDEO_FORMAT_MASK_H265) {
|
||||
decoder = avcodec_find_decoder_by_name("hevc");
|
||||
} else {
|
||||
printf("Video format not supported\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (decoder == NULL) {
|
||||
|
@ -254,18 +254,15 @@ int rk_setup(int videoFormat, int width, int height, int redrawRate, void* conte
|
||||
int ret;
|
||||
int i;
|
||||
int j;
|
||||
int format = 0;
|
||||
int format;
|
||||
|
||||
switch (videoFormat) {
|
||||
case VIDEO_FORMAT_H264:
|
||||
format = RK_H264;
|
||||
break;
|
||||
case VIDEO_FORMAT_H265:
|
||||
format = RK_H265;
|
||||
break;
|
||||
default:
|
||||
fprintf(stderr, "Video format not supported\n");
|
||||
return -1;
|
||||
if (videoFormat & VIDEO_FORMAT_MASK_H264) {
|
||||
format = RK_H264;
|
||||
} else if (videoFormat & VIDEO_FORMAT_MASK_H265) {
|
||||
format = RK_H265;
|
||||
} else {
|
||||
fprintf(stderr, "Video format not supported\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
MppCodingType mpp_type = (MppCodingType)format;
|
||||
@ -328,7 +325,7 @@ int rk_setup(int videoFormat, int width, int height, int redrawRate, void* conte
|
||||
continue;
|
||||
}
|
||||
for (j = 0; j < ovr->count_formats; j++) {
|
||||
if (ovr->formats[j] == DRM_FORMAT_NV12) {
|
||||
if (ovr->formats[j] == ((videoFormat & VIDEO_FORMAT_MASK_10BIT) ? DRM_FORMAT_NV12_10 : DRM_FORMAT_NV12)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user