[core,codecs] fix API function names

* deprecate codecs_new and codecs_free
* add new freerdp_client_codecs_new and freerdp_client_codecs_free
This commit is contained in:
Armin Novak 2024-05-29 13:39:17 +02:00
parent fc9fef65cb
commit 496dcff1cf
No known key found for this signature in database
GPG Key ID: 2CF4A2D2D3D72105
5 changed files with 40 additions and 18 deletions

View File

@ -54,7 +54,7 @@ extern "C"
struct rdp_codecs
{
rdpContext* context;
UINT32 ThreadingFlags;
RFX_CONTEXT* rfx;
NSC_CONTEXT* nsc;
@ -71,10 +71,17 @@ extern "C"
FREERDP_API BOOL freerdp_client_codecs_reset(rdpCodecs* codecs, UINT32 flags, UINT32 width,
UINT32 height);
FREERDP_API void codecs_free(rdpCodecs* codecs);
FREERDP_API void freerdp_client_codecs_free(rdpCodecs* codecs);
WINPR_ATTR_MALLOC(freerdp_client_codecs_free, 1)
FREERDP_API rdpCodecs* freerdp_client_codecs_new(UINT32 TheadingFlags);
FREERDP_API WINPR_DEPRECATED_VAR("Use freerdp_client_codecs_free",
void codecs_free(rdpCodecs* codecs));
WINPR_ATTR_MALLOC(codecs_free, 1)
FREERDP_API rdpCodecs* codecs_new(rdpContext* context);
FREERDP_API WINPR_DEPRECATED_VAR("Use freerdp_client_codecs_new",
rdpCodecs* codecs_new(rdpContext* context));
#ifdef __cplusplus
}

View File

@ -126,11 +126,9 @@ BOOL freerdp_client_codecs_prepare(rdpCodecs* codecs, UINT32 flags, UINT32 width
}
}
UINT32 threadingFlags =
freerdp_settings_get_uint32(codecs->context->settings, FreeRDP_ThreadingFlags);
if ((flags & FREERDP_CODEC_REMOTEFX))
{
if (!(codecs->rfx = rfx_context_new_ex(FALSE, threadingFlags)))
if (!(codecs->rfx = rfx_context_new_ex(FALSE, codecs->ThreadingFlags)))
{
WLog_ERR(TAG, "Failed to create rfx codec context");
return FALSE;
@ -152,7 +150,7 @@ BOOL freerdp_client_codecs_prepare(rdpCodecs* codecs, UINT32 flags, UINT32 width
if ((flags & FREERDP_CODEC_PROGRESSIVE))
{
if (!(codecs->progressive = progressive_context_new_ex(FALSE, threadingFlags)))
if (!(codecs->progressive = progressive_context_new_ex(FALSE, codecs->ThreadingFlags)))
{
WLog_ERR(TAG, "Failed to create progressive codec context");
return FALSE;
@ -243,16 +241,31 @@ BOOL freerdp_client_codecs_reset(rdpCodecs* codecs, UINT32 flags, UINT32 width,
rdpCodecs* codecs_new(rdpContext* context)
{
rdpCodecs* codecs = NULL;
codecs = (rdpCodecs*)calloc(1, sizeof(rdpCodecs));
if (!context || !context->settings)
return NULL;
if (codecs)
codecs->context = context;
const UINT32 flags = freerdp_settings_get_uint32(context->settings, FreeRDP_ThreadingFlags);
return freerdp_client_codecs_new(flags);
}
void codecs_free(rdpCodecs* codecs)
{
freerdp_client_codecs_free(codecs);
}
rdpCodecs* freerdp_client_codecs_new(UINT32 ThreadingFlags)
{
rdpCodecs* codecs = (rdpCodecs*)calloc(1, sizeof(rdpCodecs));
if (!codecs)
return NULL;
codecs->ThreadingFlags = ThreadingFlags;
return codecs;
}
void codecs_free(rdpCodecs* codecs)
void freerdp_client_codecs_free(rdpCodecs* codecs)
{
if (!codecs)
return;

View File

@ -207,8 +207,9 @@ static BOOL rdp_client_reset_codecs(rdpContext* context)
if (!freerdp_settings_get_bool(settings, FreeRDP_DeactivateClientDecoding))
{
codecs_free(context->codecs);
context->codecs = codecs_new(context);
const UINT32 flags = freerdp_settings_get_uint32(settings, FreeRDP_ThreadingFlags);
freerdp_client_codecs_free(context->codecs);
context->codecs = freerdp_client_codecs_new(flags);
if (!context->codecs)
return FALSE;
@ -495,7 +496,7 @@ BOOL rdp_client_disconnect(rdpRdp* rdp)
if (freerdp_channels_disconnect(context->channels, context->instance) != CHANNEL_RC_OK)
return FALSE;
codecs_free(context->codecs);
freerdp_client_codecs_free(context->codecs);
context->codecs = NULL;
return TRUE;
}

View File

@ -896,7 +896,7 @@ void freerdp_context_free(freerdp* instance)
freerdp_channels_free(ctx->channels);
ctx->channels = NULL;
codecs_free(ctx->codecs);
freerdp_client_codecs_free(ctx->codecs);
ctx->codecs = NULL;
stream_dump_free(ctx->dump);

View File

@ -1859,8 +1859,9 @@ BOOL gdi_graphics_pipeline_init_ex(rdpGdi* gdi, RdpgfxClientContext* gfx,
{
const UINT32 w = freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth);
const UINT32 h = freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight);
const UINT32 flags = freerdp_settings_get_uint32(settings, FreeRDP_ThreadingFlags);
gfx->codecs = codecs_new(context);
gfx->codecs = freerdp_client_codecs_new(flags);
if (!gfx->codecs)
return FALSE;
if (!freerdp_client_codecs_prepare(gfx->codecs, FREERDP_CODEC_ALL, w, h))
@ -1895,7 +1896,7 @@ void gdi_graphics_pipeline_uninit(rdpGdi* gdi, RdpgfxClientContext* gfx)
return;
gfx->custom = NULL;
codecs_free(gfx->codecs);
freerdp_client_codecs_free(gfx->codecs);
gfx->codecs = NULL;
DeleteCriticalSection(&gfx->mux);
PROFILER_PRINT_HEADER