[core,codecs] add stringify helper

add freerdp_codec_id_to_str to get a string representation of a given
codec id
This commit is contained in:
akallabeth
2025-10-06 08:37:35 +02:00
parent 8ccdfb70b2
commit fc2ae4cf41
2 changed files with 25 additions and 0 deletions

View File

@@ -95,6 +95,13 @@ extern "C"
FREERDP_API rdpCodecs* codecs_new(rdpContext* context)); FREERDP_API rdpCodecs* codecs_new(rdpContext* context));
#endif #endif
/** @brief return a string representation of the given codecid
* * @param id The codec to stringify
* @return The name of the codecid
* @since version 3.18.0
*/
FREERDP_API const char* freerdp_codec_id_to_str(enum RDP_CODEC_ID id);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@@ -276,3 +276,21 @@ void freerdp_client_codecs_free(rdpCodecs* codecs)
free(codecs); free(codecs);
} }
const char* freerdp_codec_id_to_str(enum RDP_CODEC_ID id)
{
#define ENTRY(x) \
case x: \
return #x
switch (id)
{
ENTRY(RDP_CODEC_ID_NONE);
ENTRY(RDP_CODEC_ID_NSCODEC);
ENTRY(RDP_CODEC_ID_JPEG);
ENTRY(RDP_CODEC_ID_REMOTEFX);
ENTRY(RDP_CODEC_ID_IMAGE_REMOTEFX);
default:
return "RDP_CODEC_ID_UNKNOWN";
}
#undef ENTRY
}