[codec,h264] add getter/setter for h264 options
This commit is contained in:
parent
983c820f16
commit
7739815a90
@ -41,15 +41,19 @@ extern "C"
|
||||
H264_RATECONTROL_CQP
|
||||
} H264_RATECONTROL_MODE;
|
||||
|
||||
static INLINE void free_h264_metablock(RDPGFX_H264_METABLOCK* meta)
|
||||
typedef enum
|
||||
{
|
||||
RDPGFX_H264_METABLOCK m = { 0 };
|
||||
if (!meta)
|
||||
return;
|
||||
free(meta->quantQualityVals);
|
||||
free(meta->regionRects);
|
||||
*meta = m;
|
||||
}
|
||||
H264_CONTEXT_OPTION_RATECONTROL,
|
||||
H264_CONTEXT_OPTION_BITRATE,
|
||||
H264_CONTEXT_OPTION_FRAMERATE,
|
||||
H264_CONTEXT_OPTION_QP
|
||||
} H264_CONTEXT_OPTION;
|
||||
|
||||
FREERDP_API void free_h264_metablock(RDPGFX_H264_METABLOCK* meta);
|
||||
|
||||
FREERDP_API BOOL h264_context_set_option(H264_CONTEXT* h264, H264_CONTEXT_OPTION option,
|
||||
UINT32 value);
|
||||
FREERDP_API UINT32 h264_context_get_option(H264_CONTEXT* h264, H264_CONTEXT_OPTION option);
|
||||
|
||||
FREERDP_API INT32 avc420_compress(H264_CONTEXT* h264, const BYTE* pSrcData, DWORD SrcFormat,
|
||||
UINT32 nSrcStep, UINT32 nSrcWidth, UINT32 nSrcHeight,
|
||||
|
@ -709,3 +709,57 @@ void h264_context_free(H264_CONTEXT* h264)
|
||||
free(h264);
|
||||
}
|
||||
}
|
||||
|
||||
void free_h264_metablock(RDPGFX_H264_METABLOCK* meta)
|
||||
{
|
||||
RDPGFX_H264_METABLOCK m = { 0 };
|
||||
if (!meta)
|
||||
return;
|
||||
free(meta->quantQualityVals);
|
||||
free(meta->regionRects);
|
||||
*meta = m;
|
||||
}
|
||||
|
||||
BOOL h264_context_set_option(H264_CONTEXT* h264, H264_CONTEXT_OPTION option, UINT32 value)
|
||||
{
|
||||
WINPR_ASSERT(h264);
|
||||
switch (option)
|
||||
{
|
||||
case H264_CONTEXT_OPTION_BITRATE:
|
||||
h264->BitRate = value;
|
||||
return TRUE;
|
||||
case H264_CONTEXT_OPTION_FRAMERATE:
|
||||
h264->FrameRate = value;
|
||||
return TRUE;
|
||||
case H264_CONTEXT_OPTION_RATECONTROL:
|
||||
h264->RateControlMode = value;
|
||||
return TRUE;
|
||||
case H264_CONTEXT_OPTION_QP:
|
||||
h264->QP = value;
|
||||
return TRUE;
|
||||
default:
|
||||
WLog_Print(h264->log, WLOG_WARN, "Unknown H264_CONTEXT_OPTION[0x%08" PRIx32 "]",
|
||||
option);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
UINT32 h264_context_get_option(H264_CONTEXT* h264, H264_CONTEXT_OPTION option)
|
||||
{
|
||||
WINPR_ASSERT(h264);
|
||||
switch (option)
|
||||
{
|
||||
case H264_CONTEXT_OPTION_BITRATE:
|
||||
return h264->BitRate;
|
||||
case H264_CONTEXT_OPTION_FRAMERATE:
|
||||
return h264->FrameRate;
|
||||
case H264_CONTEXT_OPTION_RATECONTROL:
|
||||
return h264->RateControlMode;
|
||||
case H264_CONTEXT_OPTION_QP:
|
||||
return h264->QP;
|
||||
default:
|
||||
WLog_Print(h264->log, WLOG_WARN, "Unknown H264_CONTEXT_OPTION[0x%08" PRIx32 "]",
|
||||
option);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -241,10 +241,17 @@ static int shadow_encoder_init_h264(rdpShadowEncoder* encoder)
|
||||
if (!h264_context_reset(encoder->h264, encoder->width, encoder->height))
|
||||
goto fail;
|
||||
|
||||
encoder->h264->RateControlMode = encoder->server->h264RateControlMode;
|
||||
encoder->h264->BitRate = encoder->server->h264BitRate;
|
||||
encoder->h264->FrameRate = encoder->server->h264FrameRate;
|
||||
encoder->h264->QP = encoder->server->h264QP;
|
||||
if (!h264_context_set_option(encoder->h264, H264_CONTEXT_OPTION_RATECONTROL,
|
||||
encoder->server->h264RateControlMode))
|
||||
goto fail;
|
||||
if (!h264_context_set_option(encoder->h264, H264_CONTEXT_OPTION_BITRATE,
|
||||
encoder->server->h264BitRate))
|
||||
goto fail;
|
||||
if (!h264_context_set_option(encoder->h264, H264_CONTEXT_OPTION_FRAMERATE,
|
||||
encoder->server->h264FrameRate))
|
||||
goto fail;
|
||||
if (!h264_context_set_option(encoder->h264, H264_CONTEXT_OPTION_QP, encoder->server->h264QP))
|
||||
goto fail;
|
||||
|
||||
encoder->codecs |= FREERDP_CODEC_AVC420 | FREERDP_CODEC_AVC444;
|
||||
return 1;
|
||||
|
Loading…
Reference in New Issue
Block a user