Move H264 subsystem variable to header

This commit is contained in:
akallabeth 2022-04-28 12:58:22 +02:00 committed by akallabeth
parent 8f109ec89a
commit eb95f00991
7 changed files with 54 additions and 34 deletions

View File

@ -59,7 +59,7 @@ typedef struct
UINT32 numSystemData;
void* pSystemData;
H264_CONTEXT_SUBSYSTEM* subsystem;
const H264_CONTEXT_SUBSYSTEM* subsystem;
YUV_CONTEXT* yuv;
BOOL encodingBuffer;

View File

@ -580,11 +580,7 @@ INT32 avc444_decompress(H264_CONTEXT* h264, BYTE op, const RECTANGLE_16* regionR
#define MAX_SUBSYSTEMS 10
static INIT_ONCE subsystems_once = INIT_ONCE_STATIC_INIT;
static H264_CONTEXT_SUBSYSTEM* subSystems[MAX_SUBSYSTEMS] = { 0 };
#if defined(_WIN32) && defined(WITH_MEDIA_FOUNDATION)
extern H264_CONTEXT_SUBSYSTEM g_Subsystem_MF;
#endif
static const H264_CONTEXT_SUBSYSTEM* subSystems[MAX_SUBSYSTEMS] = { 0 };
static BOOL CALLBACK h264_register_subsystems(PINIT_ONCE once, PVOID param, PVOID* context)
{
@ -592,7 +588,6 @@ static BOOL CALLBACK h264_register_subsystems(PINIT_ONCE once, PVOID param, PVOI
#ifdef WITH_MEDIACODEC
{
extern H264_CONTEXT_SUBSYSTEM g_Subsystem_mediacodec;
subSystems[i] = &g_Subsystem_mediacodec;
i++;
}
@ -605,14 +600,12 @@ static BOOL CALLBACK h264_register_subsystems(PINIT_ONCE once, PVOID param, PVOI
#endif
#ifdef WITH_OPENH264
{
extern H264_CONTEXT_SUBSYSTEM g_Subsystem_OpenH264;
subSystems[i] = &g_Subsystem_OpenH264;
i++;
}
#endif
#ifdef WITH_FFMPEG
{
extern H264_CONTEXT_SUBSYSTEM g_Subsystem_libavcodec;
subSystems[i] = &g_Subsystem_libavcodec;
i++;
}
@ -637,7 +630,7 @@ static BOOL h264_context_init(H264_CONTEXT* h264)
for (i = 0; i < MAX_SUBSYSTEMS; i++)
{
H264_CONTEXT_SUBSYSTEM* subsystem = subSystems[i];
const H264_CONTEXT_SUBSYSTEM* subsystem = subSystems[i];
if (!subsystem || !subsystem->Init)
break;

View File

@ -22,25 +22,50 @@
#define FREERDP_LIB_CODEC_H264_H
#include <freerdp/api.h>
#include <freerdp/config.h>
#include <freerdp/codec/h264.h>
typedef BOOL (*pfnH264SubsystemInit)(H264_CONTEXT* h264);
typedef void (*pfnH264SubsystemUninit)(H264_CONTEXT* h264);
typedef int (*pfnH264SubsystemDecompress)(H264_CONTEXT* h264, const BYTE* pSrcData, UINT32 SrcSize);
typedef int (*pfnH264SubsystemCompress)(H264_CONTEXT* h264, const BYTE** pSrcYuv,
const UINT32* pStride, BYTE** ppDstData, UINT32* pDstSize);
struct S_H264_CONTEXT_SUBSYSTEM
#ifdef __cplusplus
extern "C"
{
const char* name;
pfnH264SubsystemInit Init;
pfnH264SubsystemUninit Uninit;
pfnH264SubsystemDecompress Decompress;
pfnH264SubsystemCompress Compress;
};
#endif
FREERDP_LOCAL BOOL avc420_ensure_buffer(H264_CONTEXT* h264, UINT32 stride, UINT32 width,
UINT32 height);
typedef BOOL (*pfnH264SubsystemInit)(H264_CONTEXT* h264);
typedef void (*pfnH264SubsystemUninit)(H264_CONTEXT* h264);
typedef int (*pfnH264SubsystemDecompress)(H264_CONTEXT* h264, const BYTE* pSrcData,
UINT32 SrcSize);
typedef int (*pfnH264SubsystemCompress)(H264_CONTEXT* h264, const BYTE** pSrcYuv,
const UINT32* pStride, BYTE** ppDstData,
UINT32* pDstSize);
struct S_H264_CONTEXT_SUBSYSTEM
{
const char* name;
pfnH264SubsystemInit Init;
pfnH264SubsystemUninit Uninit;
pfnH264SubsystemDecompress Decompress;
pfnH264SubsystemCompress Compress;
};
FREERDP_LOCAL BOOL avc420_ensure_buffer(H264_CONTEXT* h264, UINT32 stride, UINT32 width,
UINT32 height);
#ifdef WITH_MEDIACODEC
extern const H264_CONTEXT_SUBSYSTEM g_Subsystem_mediacodec;
#endif
#if defined(_WIN32) && defined(WITH_MEDIA_FOUNDATION)
extern const H264_CONTEXT_SUBSYSTEM g_Subsystem_MF;
#endif
#ifdef WITH_OPENH264
extern const H264_CONTEXT_SUBSYSTEM g_Subsystem_OpenH264;
#endif
#ifdef WITH_FFMPEG
extern const H264_CONTEXT_SUBSYSTEM g_Subsystem_libavcodec;
#endif
#ifdef __cplusplus
}
#endif
#endif /* FREERDP_LIB_CODEC_H264_H */

View File

@ -692,5 +692,6 @@ EXCEPTION:
return FALSE;
}
H264_CONTEXT_SUBSYSTEM g_Subsystem_libavcodec = { "libavcodec", libavcodec_init, libavcodec_uninit,
libavcodec_decompress, libavcodec_compress };
const H264_CONTEXT_SUBSYSTEM g_Subsystem_libavcodec = { "libavcodec", libavcodec_init,
libavcodec_uninit, libavcodec_decompress,
libavcodec_compress };

View File

@ -522,5 +522,6 @@ EXCEPTION:
return FALSE;
}
H264_CONTEXT_SUBSYSTEM g_Subsystem_mediacodec = { "MediaCodec", mediacodec_init, mediacodec_uninit,
mediacodec_decompress, mediacodec_compress };
const H264_CONTEXT_SUBSYSTEM g_Subsystem_mediacodec = { "MediaCodec", mediacodec_init,
mediacodec_uninit, mediacodec_decompress,
mediacodec_compress };

View File

@ -592,5 +592,5 @@ error:
return FALSE;
}
H264_CONTEXT_SUBSYSTEM g_Subsystem_MF = { "MediaFoundation", mf_init, mf_uninit, mf_decompress,
mf_compress };
const H264_CONTEXT_SUBSYSTEM g_Subsystem_MF = { "MediaFoundation", mf_init, mf_uninit,
mf_decompress, mf_compress };

View File

@ -633,5 +633,5 @@ EXCEPTION:
return FALSE;
}
H264_CONTEXT_SUBSYSTEM g_Subsystem_OpenH264 = { "OpenH264", openh264_init, openh264_uninit,
openh264_decompress, openh264_compress };
const H264_CONTEXT_SUBSYSTEM g_Subsystem_OpenH264 = { "OpenH264", openh264_init, openh264_uninit,
openh264_decompress, openh264_compress };