From 2bc4c69ee9c892dd887633d9e586a3e7b3c23ab0 Mon Sep 17 00:00:00 2001 From: PatTheMav Date: Sun, 14 Apr 2024 03:54:46 +0200 Subject: [PATCH] plugins: Fix compile errors introduced by CMake build framework 3.0 --- plugins/linux-alsa/alsa-input.c | 27 ++++++++++++++++-------- plugins/linux-capture/xcomposite-input.c | 1 - plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c | 16 ++++++++++---- plugins/obs-ffmpeg/vaapi-utils.c | 1 - plugins/obs-qsv11/common_utils_linux.cpp | 1 - plugins/obs-qsv11/obs-qsv11.c | 4 ---- plugins/oss-audio/oss-input.c | 2 +- 7 files changed, 31 insertions(+), 21 deletions(-) diff --git a/plugins/linux-alsa/alsa-input.c b/plugins/linux-alsa/alsa-input.c index 8c969343d..ee866e517 100644 --- a/plugins/linux-alsa/alsa-input.c +++ b/plugins/linux-alsa/alsa-input.c @@ -317,14 +317,20 @@ obs_properties_t *alsa_get_properties(void *unused) obs_property_list_add_string(devices, descr, name); next: - if (name != NULL) - free(name), name = NULL; + if (name != NULL) { + free(name); + name = NULL; + } - if (descr != NULL) - free(descr), descr = NULL; + if (descr != NULL) { + free(descr); + descr = NULL; + } - if (io != NULL) - free(io), io = NULL; + if (io != NULL) { + free(io); + io = NULL; + } ++hint; } @@ -412,11 +418,14 @@ void _alsa_close(struct alsa_data *data) if (data->handle) { snd_pcm_drop(data->handle); - snd_pcm_close(data->handle), data->handle = NULL; + snd_pcm_close(data->handle); + data->handle = NULL; } - if (data->buffer) - bfree(data->buffer), data->buffer = NULL; + if (data->buffer) { + bfree(data->buffer); + data->buffer = NULL; + } } bool _alsa_configure(struct alsa_data *data) diff --git a/plugins/linux-capture/xcomposite-input.c b/plugins/linux-capture/xcomposite-input.c index 22589a38c..3e9788b06 100644 --- a/plugins/linux-capture/xcomposite-input.c +++ b/plugins/linux-capture/xcomposite-input.c @@ -390,7 +390,6 @@ void xcomp_create_pixmap(xcb_connection_t *conn, struct xcompcap *s, if (depth != 32) { s->exclude_alpha = true; } - xcb_window_t root = geom->root; free(geom); uint32_t vert_borders = s->crop_top + s->crop_bot + 2 * s->border; diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c index 127ef658a..fabde2aa9 100644 --- a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c +++ b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c @@ -562,27 +562,35 @@ static bool vaapi_encode(void *data, struct encoder_frame *frame, size_t size; enc->first_packet = false; + + switch (enc->codec) { + case CODEC_HEVC: #ifdef ENABLE_HEVC - if (enc->codec == CODEC_HEVC) { obs_extract_hevc_headers( enc->packet->data, enc->packet->size, &new_packet, &size, &enc->header, &enc->header_size, &enc->sei, &enc->sei_size); - } else + break; +#else + warn("vaapi_encode: HEVC codec is not supported"); + goto fail; #endif - if (enc->codec == CODEC_H264) { + case CODEC_H264: obs_extract_avc_headers( enc->packet->data, enc->packet->size, &new_packet, &size, &enc->header, &enc->header_size, &enc->sei, &enc->sei_size); - } else if (enc->codec == CODEC_AV1) { + break; + + case CODEC_AV1: obs_extract_av1_headers(enc->packet->data, enc->packet->size, &new_packet, &size, &enc->header, &enc->header_size); + break; } da_copy_array(enc->buffer, new_packet, size); diff --git a/plugins/obs-ffmpeg/vaapi-utils.c b/plugins/obs-ffmpeg/vaapi-utils.c index 036949d0a..d636558b7 100644 --- a/plugins/obs-ffmpeg/vaapi-utils.c +++ b/plugins/obs-ffmpeg/vaapi-utils.c @@ -128,7 +128,6 @@ static uint32_t vaapi_display_ep_combo_rate_controls(VAProfile profile, VADisplay dpy, const char *device_path) { - bool ret = false; VAStatus va_status; VAConfigAttrib attrib[1]; attrib->type = VAConfigAttribRateControl; diff --git a/plugins/obs-qsv11/common_utils_linux.cpp b/plugins/obs-qsv11/common_utils_linux.cpp index cdadafda2..4ddb3a127 100644 --- a/plugins/obs-qsv11/common_utils_linux.cpp +++ b/plugins/obs-qsv11/common_utils_linux.cpp @@ -252,7 +252,6 @@ static void vaapi_close(struct vaapi_device *device) static uint32_t vaapi_check_support(VADisplay display, VAProfile profile, VAEntrypoint entrypoint) { - bool ret = false; VAConfigAttrib attrib[1]; attrib->type = VAConfigAttribRateControl; diff --git a/plugins/obs-qsv11/obs-qsv11.c b/plugins/obs-qsv11/obs-qsv11.c index cf9d2b8fe..87f3ab351 100644 --- a/plugins/obs-qsv11/obs-qsv11.c +++ b/plugins/obs-qsv11/obs-qsv11.c @@ -1253,8 +1253,6 @@ static void parse_packet_av1(struct obs_qsv *obsqsv, packet->priority = priority; - bool pFrame = pBS->FrameType & MFX_FRAMETYPE_P; - packet->dts = ts_mfx_to_obs(pBS->DecodeTimeStamp, voi); #if 0 @@ -1276,8 +1274,6 @@ static void parse_packet_hevc(struct obs_qsv *obsqsv, const struct video_output_info *voi, bool *received_packet) { - bool is_vcl_packet = false; - if (pBS == NULL || pBS->DataLength == 0) { *received_packet = false; return; diff --git a/plugins/oss-audio/oss-input.c b/plugins/oss-audio/oss-input.c index 368ca5acf..04581529e 100644 --- a/plugins/oss-audio/oss-input.c +++ b/plugins/oss-audio/oss-input.c @@ -26,7 +26,7 @@ along with this program. If not, see . #include #include #include -#include "oss-platform.h" +#include #define blog(level, msg, ...) blog(level, "oss-audio: " msg, ##__VA_ARGS__)