Skip to content

Commit

Permalink
CI: fix build with g++
Browse files Browse the repository at this point in the history
  • Loading branch information
metalefty committed Nov 30, 2024
1 parent efd2a5f commit 1f74ede
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions xrdp/xrdp_encoder_openh264.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ struct openh264_global
openh264_param[NUM_CONNECTION_TYPES];
};

/* The method invocations on ISVCEncoder are different for C and C++, as
ISVCEncoder is a true class in C++, but an emulated one in C */
#ifdef __cplusplus /* compiling with g++ */
#define ENC_GET_DEFAULT_PARAMS(obj, pParam) (obj)->GetDefaultParams(pParam)
#define ENC_INITIALIZE_EXT(obj, pParam) (obj)->InitializeExt(pParam)
#define ENC_ENCODE_FRAME(obj, kpSrcPic, pBsInfo) \
(obj)->EncodeFrame(kpSrcPic, pBsInfo)
#else
#define ENC_GET_DEFAULT_PARAMS(obj, pParam) (*obj)->GetDefaultParams(obj, pParam)
#define ENC_INITIALIZE_EXT(obj, pParam) (*obj)->InitializeExt(obj, pParam)
#define ENC_ENCODE_FRAME(obj, kpSrcPic, pBsInfo) \
(*obj)->EncodeFrame(obj, kpSrcPic, pBsInfo)
#endif

/*****************************************************************************/
void *
xrdp_encoder_openh264_create(void)
Expand Down Expand Up @@ -167,7 +181,7 @@ xrdp_encoder_openh264_encode(void *handle, int session, int left, int top,
LOG(LOG_LEVEL_INFO, "xrdp_encoder_openh264_encode: "
"WelsCreateSVCEncoder rv %p for width %d height %d",
oe->openh264_enc_han, width, height);
status = (*oe->openh264_enc_han)->GetDefaultParams(
status = ENC_GET_DEFAULT_PARAMS(
oe->openh264_enc_han, &encParamExt);
LOG(LOG_LEVEL_INFO, "xrdp_encoder_openh264_encode: "
"GetDefaultParams rv %d", status);
Expand All @@ -191,7 +205,7 @@ xrdp_encoder_openh264_encode(void *handle, int session, int left, int top,
slc->iVideoHeight = encParamExt.iPicHeight;
slc->iSpatialBitrate = encParamExt.iTargetBitrate;
slc->iMaxSpatialBitrate = encParamExt.iMaxBitrate;
status = (*oe->openh264_enc_han)->InitializeExt(
status = ENC_INITIALIZE_EXT(
oe->openh264_enc_han, &encParamExt);
LOG(LOG_LEVEL_INFO, "xrdp_encoder_openh264_encode: "
"InitializeExt rv %d", status);
Expand Down Expand Up @@ -270,8 +284,7 @@ xrdp_encoder_openh264_encode(void *handle, int session, int left, int top,
}
}
g_memset(&info, 0, sizeof(info));
status = (*oe->openh264_enc_han)->EncodeFrame(oe->openh264_enc_han,
&pic1, &info);
status = ENC_ENCODE_FRAME(oe->openh264_enc_han, &pic1, &info);
if (status != 0)
{
LOG(LOG_LEVEL_TRACE, "OpenH264: Failed to encode frame");
Expand Down

0 comments on commit 1f74ede

Please sign in to comment.