From dcbb61e3b36093eecdfdf3e23ecdfd2c54a8198f Mon Sep 17 00:00:00 2001 From: David Fort Date: Wed, 14 Jun 2017 16:14:19 +0200 Subject: [PATCH] Fix variable declaration and win32 compilation --- libfreerdp/codec/h264.c | 15 ++++++++++----- libfreerdp/codec/h264_mf.c | 5 +++++ libfreerdp/codec/h264_openh264.c | 2 ++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/libfreerdp/codec/h264.c b/libfreerdp/codec/h264.c index 7bb3bb8..0e163cd 100644 --- a/libfreerdp/codec/h264.c +++ b/libfreerdp/codec/h264.c @@ -67,7 +67,7 @@ static H264_CONTEXT_SUBSYSTEM g_Subsystem_dummy = dummy_compress }; -static BOOL avc420_ensure_buffer(H264_CONTEXT* h264, UINT32 stride, UINT32 width, UINT32 height) +BOOL avc420_ensure_buffer(H264_CONTEXT* h264, UINT32 stride, UINT32 width, UINT32 height) { if (!h264) return FALSE; @@ -444,13 +444,16 @@ INT32 avc444_decompress(H264_CONTEXT* h264, BYTE op, static INIT_ONCE subsystems_once = INIT_ONCE_STATIC_INIT; static H264_CONTEXT_SUBSYSTEM *subSystems[MAX_SUBSYSTEMS]; +#if defined(_WIN32) && defined(WITH_MEDIA_FOUNDATION) +extern H264_CONTEXT_SUBSYSTEM g_Subsystem_MF; +#endif + static BOOL CALLBACK h264_register_subsystems(PINIT_ONCE once, PVOID param, PVOID *context) { - ZeroMemory(subSystems, sizeof(subSystems)); int i = 0; + ZeroMemory(subSystems, sizeof(subSystems)); #if defined(_WIN32) && defined(WITH_MEDIA_FOUNDATION) - extern H264_CONTEXT_SUBSYSTEM g_Subsystem_MF; - subSystems[i] = &g_Subsystem_MF + subSystems[i] = &g_Subsystem_MF; i++; #endif @@ -479,9 +482,11 @@ static BOOL CALLBACK h264_register_subsystems(PINIT_ONCE once, PVOID param, PVOI BOOL h264_context_init(H264_CONTEXT* h264) { + int i; + InitOnceExecuteOnce(&subsystems_once, h264_register_subsystems, NULL, NULL); - for (int i = 0; i < MAX_SUBSYSTEMS; i++) + for (i = 0; i < MAX_SUBSYSTEMS; i++) { if (subSystems[i]->Init(h264)) { diff --git a/libfreerdp/codec/h264_mf.c b/libfreerdp/codec/h264_mf.c index 2307cb7..7037ca7 100644 --- a/libfreerdp/codec/h264_mf.c +++ b/libfreerdp/codec/h264_mf.c @@ -17,6 +17,7 @@ * limitations under the License. */ +#include #include #include @@ -31,6 +32,10 @@ #define INITGUID #include +#define TAG FREERDP_TAG("codec") + +BOOL avc420_ensure_buffer(H264_CONTEXT* h264, UINT32 stride, UINT32 width, UINT32 height); + DEFINE_GUID(CLSID_CMSH264DecoderMFT, 0x62CE7E72, 0x4C71, 0x4d20, 0xB1, 0x5D, 0x45, 0x28, 0x31, 0xA8, 0x7D, 0x9D); DEFINE_GUID(CLSID_VideoProcessorMFT, 0x88753b26, 0x5b24, 0x49bd, 0xb2, 0xe7, diff --git a/libfreerdp/codec/h264_openh264.c b/libfreerdp/codec/h264_openh264.c index 4a4eb1b..fff599e 100644 --- a/libfreerdp/codec/h264_openh264.c +++ b/libfreerdp/codec/h264_openh264.c @@ -24,6 +24,8 @@ #include "wels/codec_api.h" #include "wels/codec_ver.h" +#define TAG FREERDP_TAG("codec") + #if (OPENH264_MAJOR == 1) && (OPENH264_MINOR < 3) || (OPENH264_MAJOR < 1) #error "Unsupported OpenH264 version "OPENH264_MAJOR"."OPENH264_MINOR"."OPENH264_REVISION" detected!" #elif (OPENH264_MAJOR > 1) || (OPENH264_MINOR > 6) -- 2.7.4