diff --git a/src/aja_win32_stub.cpp b/src/aja_win32_stub.cpp index 330fb08f75..7a18722a5f 100644 --- a/src/aja_win32_stub.cpp +++ b/src/aja_win32_stub.cpp @@ -66,15 +66,15 @@ static const struct video_capture_info vidcap_aja_info = { REGISTER_MODULE(aja, &vidcap_aja_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); extern "C" { -__declspec(dllimport) int display_aja_get_property(void *state, int property, void *val, size_t *len); +__declspec(dllimport) bool display_aja_get_property(void *state, int property, void *val, size_t *len); __declspec(dllimport) void display_aja_probe(struct device_info **available_cards, int *count, void (**deleter)(void *)); -__declspec(dllimport) int display_aja_reconfigure(void *state, struct video_desc desc); +__declspec(dllimport) bool display_aja_reconfigure(void *state, struct video_desc desc); __declspec(dllimport) void *display_aja_init(struct module * /* parent */, const char *fmt, unsigned int flags); __declspec(dllimport) void display_aja_done(void *state); __declspec(dllimport) struct video_frame *display_aja_getf(void *state); __declspec(dllimport) bool display_aja_putf(void *state, struct video_frame *frame, long long nonblock); __declspec(dllimport) void display_aja_put_audio_frame(void *state, const struct audio_frame *frame); -__declspec(dllimport) int display_aja_reconfigure_audio(void *state, int quant_samples, int channels, +__declspec(dllimport) bool display_aja_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate); } diff --git a/src/audio/audio.cpp b/src/audio/audio.cpp index d6ba000abe..1a4308ead7 100644 --- a/src/audio/audio.cpp +++ b/src/audio/audio.cpp @@ -1128,7 +1128,13 @@ void audio_sdi_send(struct state_audio *s, struct audio_frame *frame) { sdi_capture_new_incoming_frame(sdi_capture, frame); } -void audio_register_display_callbacks(struct state_audio *s, void *udata, void (*putf)(void *, const struct audio_frame *), int (*reconfigure)(void *, int, int, int), int (*get_property)(void *, int, void *, size_t *)) +void +audio_register_display_callbacks(struct state_audio *s, void *udata, + void (*putf)(void *, + const struct audio_frame *), + bool (*reconfigure)(void *, int, int, int), + bool (*get_property)(void *, int, void *, + size_t *)) { struct state_sdi_playback *sdi_playback; if(!audio_playback_get_display_flags(s->audio_playback_device)) diff --git a/src/audio/audio.h b/src/audio/audio.h index 6e36a9491e..5cc9b0cd9e 100644 --- a/src/audio/audio.h +++ b/src/audio/audio.h @@ -97,7 +97,12 @@ void audio_join(struct state_audio *s); void audio_sdi_send(struct state_audio *s, struct audio_frame *frame); struct audio_frame * sdi_get_frame(void *state); void sdi_put_frame(void *state, struct audio_frame *frame); -void audio_register_display_callbacks(struct state_audio *s, void *udata, void (*putf)(void *, const struct audio_frame *), int (*reconfigure)(void *, int, int, int), int (*get_property)(void *, int, void *, size_t *)); +void audio_register_display_callbacks(struct state_audio *s, void *udata, + void (*putf)(void *, + const struct audio_frame *), + bool (*reconfigure)(void *, int, int, int), + bool (*get_property)(void *, int, void *, + size_t *)); struct audio_frame * audio_get_frame(struct state_audio *s); diff --git a/src/audio/audio_playback.c b/src/audio/audio_playback.c index a3b453c81a..450f40d39b 100644 --- a/src/audio/audio_playback.c +++ b/src/audio/audio_playback.c @@ -160,7 +160,7 @@ bool audio_playback_ctl(struct state_audio_playback *s, int request, void *data, return s->funcs->ctl(s->state, request, data, len); } -int audio_playback_reconfigure(struct state_audio_playback *s, int quant_samples, int channels, +bool audio_playback_reconfigure(struct state_audio_playback *s, int quant_samples, int channels, int sample_rate) { return s->funcs->reconfigure(s->state, (struct audio_desc){quant_samples / 8, sample_rate, channels, AC_PCM}); diff --git a/src/audio/audio_playback.h b/src/audio/audio_playback.h index 062c3283f2..197fd5a592 100644 --- a/src/audio/audio_playback.h +++ b/src/audio/audio_playback.h @@ -42,9 +42,11 @@ struct audio_frame; #ifdef __cplusplus extern "C" { +#else +#include #endif -#define AUDIO_PLAYBACK_ABI_VERSION 10 +#define AUDIO_PLAYBACK_ABI_VERSION 11 /** @anchor audio_playback_ctl_reqs * @name Audio playback control requests @@ -81,7 +83,7 @@ struct audio_playback_info { void (*write)(void *state, const struct audio_frame *frame); /** Returns device supported format that matches best with propsed audio desc */ bool (*ctl)(void *state, int request, void *data, size_t *len); - int (*reconfigure)(void *state, struct audio_desc); + bool (*reconfigure)(void *state, struct audio_desc); void (*done)(void *state); }; @@ -114,12 +116,10 @@ bool audio_playback_ctl(struct state_audio_playback *s, int request, void *data, * @param[in] quant_samples number of quantization bits * @param[in] channels number of channels to be played back * @param[in] sample_rate sample rate - * @retval TRUE if reconfiguration succeeded - * @retval FALSE if reconfiguration failed */ -int audio_playback_reconfigure(struct state_audio_playback *state, - int quant_samples, int channels, - int sample_rate); +bool audio_playback_reconfigure(struct state_audio_playback *state, + int quant_samples, int channels, + int sample_rate); void audio_playback_put_frame(struct state_audio_playback *state, const struct audio_frame *frame); void audio_playback_finish(struct state_audio_playback *state); void audio_playback_done(struct state_audio_playback *state); diff --git a/src/audio/playback/alsa.c b/src/audio/playback/alsa.c index fdf9001077..88937e228b 100644 --- a/src/audio/playback/alsa.c +++ b/src/audio/playback/alsa.c @@ -435,7 +435,7 @@ ADD_TO_PARAM("alsa-play-period-size", "* alsa-play-period-size=\n" * with PulseAudio. However, may underrun with different drivers/devices (Juli@?) where * the buffer size is significantly lower. */ -static int audio_play_alsa_reconfigure(void *state, struct audio_desc desc) +static bool audio_play_alsa_reconfigure(void *state, struct audio_desc desc) { struct state_alsa_playback *s = (struct state_alsa_playback *) state; snd_pcm_hw_params_t *params; @@ -479,7 +479,7 @@ static int audio_play_alsa_reconfigure(void *state, struct audio_desc desc) if (rc < 0) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "cannot obtain default hw parameters: %s\n", snd_strerror(rc)); - return FALSE; + return false; } /* Set the desired hardware parameters. */ @@ -495,7 +495,7 @@ static int audio_play_alsa_reconfigure(void *state, struct audio_desc desc) if (rc < 0) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "cannot set non-interleaved hw access: %s\n", snd_strerror(rc)); - return FALSE; + return false; } s->non_interleaved = true; } else { @@ -505,7 +505,7 @@ static int audio_play_alsa_reconfigure(void *state, struct audio_desc desc) if (desc.bps > 4 || desc.bps < 1) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "Unsupported BPS for audio (%d).\n", desc.bps * 8); - return FALSE; + return false; } format = bps_to_snd_fmts[desc.bps]; @@ -516,7 +516,7 @@ static int audio_play_alsa_reconfigure(void *state, struct audio_desc desc) if (rc < 0) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "cannot set format: %s\n", snd_strerror(rc)); - return FALSE; + return false; } /* Two channels (stereo) */ @@ -524,7 +524,7 @@ static int audio_play_alsa_reconfigure(void *state, struct audio_desc desc) if (rc < 0) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "cannot set requested channel count: %s\n", snd_strerror(rc)); - return FALSE; + return false; } /* we want to resample if device doesn't support default sample rate */ @@ -545,7 +545,7 @@ static int audio_play_alsa_reconfigure(void *state, struct audio_desc desc) if (rc < 0) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "cannot set requested sample rate: %s\n", snd_strerror(rc)); - return FALSE; + return false; } /* Set period to its minimal size. @@ -599,7 +599,7 @@ static int audio_play_alsa_reconfigure(void *state, struct audio_desc desc) if (rc < 0) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "unable to set hw parameters: %s\n", snd_strerror(rc)); - return FALSE; + return false; } snd_pcm_hw_params_current(s->handle, params); @@ -653,9 +653,9 @@ static int audio_play_alsa_reconfigure(void *state, struct audio_desc desc) } } - return TRUE; + return true; error: - return FALSE; + return false; } static void audio_play_alsa_probe(struct device_info **available_devices, int *count, void (**deleter)(void *)) diff --git a/src/audio/playback/coreaudio.cpp b/src/audio/playback/coreaudio.cpp index 98a3473761..4261477557 100644 --- a/src/audio/playback/coreaudio.cpp +++ b/src/audio/playback/coreaudio.cpp @@ -150,7 +150,7 @@ static bool audio_play_ca_ctl(void *state [[gnu::unused]], int request, void *da ADD_TO_PARAM("ca-disable-adaptive-buf", "* ca-disable-adaptive-buf\n" " Core Audio - use fixed audio playback buffer instead of an adaptive one\n"); -static int audio_play_ca_reconfigure(void *state, struct audio_desc desc) +static bool audio_play_ca_reconfigure(void *state, struct audio_desc desc) { struct state_ca_playback *s = (struct state_ca_playback *)state; AudioStreamBasicDescription stream_desc; @@ -242,10 +242,10 @@ static int audio_play_ca_reconfigure(void *state, struct audio_desc desc) s->initialized = true; - return TRUE; + return true; error: - return FALSE; + return false; } diff --git a/src/audio/playback/decklink.cpp b/src/audio/playback/decklink.cpp index 6dab5bfd6a..b84bb40433 100644 --- a/src/audio/playback/decklink.cpp +++ b/src/audio/playback/decklink.cpp @@ -394,7 +394,7 @@ static bool audio_play_decklink_ctl(void *state [[gnu::unused]], int request, vo } } -static int audio_play_decklink_reconfigure(void *state, struct audio_desc desc) { +static bool audio_play_decklink_reconfigure(void *state, struct audio_desc desc) { struct state_decklink *s = (struct state_decklink *)state; BMDAudioSampleType sample_type; @@ -407,7 +407,7 @@ static int audio_play_decklink_reconfigure(void *state, struct audio_desc desc) s->audio_desc.ch_count != 16) { fprintf(stderr, "[decklink] requested channel count isn't supported: " "%d\n", s->audio_desc.ch_count); - return FALSE; + return false; } /* toggle one channel to supported two */ @@ -419,7 +419,7 @@ static int audio_play_decklink_reconfigure(void *state, struct audio_desc desc) desc.sample_rate != 48000) { LOG(LOG_LEVEL_ERROR) << "[decklink] audio format isn't supported: " << desc; - return FALSE; + return false; } switch(desc.bps) { case 2: @@ -429,7 +429,7 @@ static int audio_play_decklink_reconfigure(void *state, struct audio_desc desc) sample_type = bmdAudioSampleType32bitInteger; break; default: - return FALSE; + return false; } s->deckLinkOutput->EnableAudioOutput(bmdAudioSampleRate48kHz, @@ -438,7 +438,7 @@ static int audio_play_decklink_reconfigure(void *state, struct audio_desc desc) bmdAudioOutputStreamContinuous); s->deckLinkOutput->StartScheduledPlayback(0, s->frameRateScale, s->frameRateDuration); - return TRUE; + return true; } static void audio_play_decklink_done(void *state) diff --git a/src/audio/playback/dummy.c b/src/audio/playback/dummy.c index 08582e5f19..8449ff4565 100644 --- a/src/audio/playback/dummy.c +++ b/src/audio/playback/dummy.c @@ -91,10 +91,10 @@ static bool audio_play_dummy_ctl(void *state, int request, void *data, size_t *l } } -static int audio_play_dummy_reconfigure(void *state, struct audio_desc desc) +static bool audio_play_dummy_reconfigure(void *state, struct audio_desc desc) { UNUSED(state), UNUSED(desc); - return TRUE; + return true; } static const struct audio_playback_info aplay_dummy_info = { diff --git a/src/audio/playback/dump.cpp b/src/audio/playback/dump.cpp index a051e28879..6eabfcea86 100644 --- a/src/audio/playback/dump.cpp +++ b/src/audio/playback/dump.cpp @@ -132,7 +132,7 @@ static void audio_play_dump_put_frame(void *state, const struct audio_frame *f) audio_export(s->exporter.get(), f); } -static int audio_play_dump_reconfigure(void *state, struct audio_desc new_desc) +static bool audio_play_dump_reconfigure(void *state, struct audio_desc new_desc) { auto *s = static_cast(state); s->desc = new_desc; diff --git a/src/audio/playback/jack.c b/src/audio/playback/jack.c index 3b20712425..bc50a27c32 100644 --- a/src/audio/playback/jack.c +++ b/src/audio/playback/jack.c @@ -294,7 +294,7 @@ static bool audio_play_jack_ctl(void *state, int request, void *data, size_t *le } } -static int audio_play_jack_reconfigure(void *state, struct audio_desc desc) +static bool audio_play_jack_reconfigure(void *state, struct audio_desc desc) { struct state_jack_playback *s = (struct state_jack_playback *) state; const char **ports; @@ -307,7 +307,7 @@ static int audio_play_jack_reconfigure(void *state, struct audio_desc desc) ports = s->libjack->get_ports(s->client, s->jack_ports_pattern, NULL, JackPortIsInput); if(ports == NULL) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "Unable to input ports matching %s.\n", s->jack_ports_pattern); - return FALSE; + return false; } if(desc.ch_count > s->jack_ports_count) { @@ -356,18 +356,18 @@ static int audio_play_jack_reconfigure(void *state, struct audio_desc desc) if (s->libjack->activate(s->client)) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "Cannot activate client.\n"); - return FALSE; + return false; } for(i = 0; i < desc.ch_count; ++i) { if (s->libjack->connect (s->client, s->libjack->port_name (s->output_port[i]), ports[i])) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "Cannot connect output port: %d.\n", i); - return FALSE; + return false; } } free(ports); - return TRUE; + return true; } static void audio_play_jack_put_frame(void *state, const struct audio_frame *frame) diff --git a/src/audio/playback/mixer.cpp b/src/audio/playback/mixer.cpp index 83e5fa1234..b6704ef5e2 100644 --- a/src/audio/playback/mixer.cpp +++ b/src/audio/playback/mixer.cpp @@ -473,11 +473,11 @@ static bool audio_play_mixer_ctl(void *state, int request, void *data, size_t *l } } -static int audio_play_mixer_reconfigure(void *state [[gnu::unused]], struct audio_desc desc) +static bool audio_play_mixer_reconfigure(void *state [[gnu::unused]], struct audio_desc desc) { audio_desc requested{BPS, SAMPLE_RATE, CHANNELS, AC_PCM}; assert(desc == requested); - return TRUE; + return true; } static const struct audio_playback_info aplay_mixer_info = { diff --git a/src/audio/playback/none.c b/src/audio/playback/none.c index 228c6f7388..802d418add 100644 --- a/src/audio/playback/none.c +++ b/src/audio/playback/none.c @@ -100,14 +100,14 @@ static bool audio_play_none_ctl(void *state, int request, void *data, size_t *le return false; } -static int audio_play_none_reconfigure(void *state, struct audio_desc desc) +static bool audio_play_none_reconfigure(void *state, struct audio_desc desc) { UNUSED(desc); struct state_audio_playback_none *s = (struct state_audio_playback_none *) state; assert(s->magic == AUDIO_PLAYBACK_NONE_MAGIC); - return TRUE; + return true; } static const struct audio_playback_info aplay_none_info = { diff --git a/src/audio/playback/portaudio.c b/src/audio/playback/portaudio.c index 310ddc2d46..0fa1108b24 100644 --- a/src/audio/playback/portaudio.c +++ b/src/audio/playback/portaudio.c @@ -103,7 +103,7 @@ static int callback( const void *inputBuffer, void *outputBuffer, PaStreamCallbackFlags statusFlags, void *userData ); static void cleanup(struct state_portaudio_playback * s); -static int audio_play_portaudio_reconfigure(void *state, struct audio_desc); +static bool audio_play_portaudio_reconfigure(void *state, struct audio_desc); /* * Shared functions @@ -317,7 +317,7 @@ static bool audio_play_portaudio_ctl(void *state, int request, void *data, size_ } } -static int audio_play_portaudio_reconfigure(void *state, struct audio_desc desc) +static bool audio_play_portaudio_reconfigure(void *state, struct audio_desc desc) { struct state_portaudio_playback * s = (struct state_portaudio_playback *) state; @@ -344,7 +344,7 @@ static int audio_play_portaudio_reconfigure(void *state, struct audio_desc desc) if (error != paNoError) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "error initializing portaudio\n"); log_msg(LOG_LEVEL_ERROR, "\tPortAudio error: %s\n", Pa_GetErrorText( error ) ); - return FALSE; + return false; } log_msg(LOG_LEVEL_INFO, "Using PortAudio version: %s\n", Pa_GetVersionText()); @@ -393,14 +393,14 @@ static int audio_play_portaudio_reconfigure(void *state, struct audio_desc desc) if (error != paNoError) { log_msg(LOG_LEVEL_ERROR, "[Portaudio] Unable to open stream: %s\n", Pa_GetErrorText(error)); - return FALSE; + return false; } if (!portaudio_start_stream(s->stream)) { - return FALSE; + return false; } - return TRUE; + return true; } /* This routine will be called by the PortAudio engine when audio is needed. diff --git a/src/audio/playback/sdi.c b/src/audio/playback/sdi.c index 19995b5ba0..0f3b4cdbc0 100644 --- a/src/audio/playback/sdi.c +++ b/src/audio/playback/sdi.c @@ -54,9 +54,9 @@ struct state_sdi_playback { void *udata; void (*put_callback)(void *, const struct audio_frame *); - int (*reconfigure_callback)(void *state, int quant_samples, int channels, - int sample_rate); - int (*get_property_callback)(void *, int, void *, size_t *); + bool (*reconfigure_callback)(void *state, int quant_samples, + int channels, int sample_rate); + bool (*get_property_callback)(void *, int, void *, size_t *); }; static void audio_play_sdi_probe_common(struct device_info **available_devices, int *count, @@ -113,7 +113,12 @@ static void * audio_play_sdi_init(const char *cfg) return s; } -void sdi_register_display_callbacks(void *state, void *udata, void (*putf)(void *, const struct audio_frame *), int (*reconfigure)(void *, int, int, int), int (*get_property)(void *, int, void *, size_t *)) +void +sdi_register_display_callbacks(void *state, void *udata, + void (*putf)(void *, const struct audio_frame *), + bool (*reconfigure)(void *, int, int, int), + bool (*get_property)(void *, int, void *, + size_t *)) { struct state_sdi_playback *s = (struct state_sdi_playback *) state; @@ -160,17 +165,15 @@ static bool audio_play_sdi_ctl(void *state, int request, void *data, size_t *len } } -static int audio_play_sdi_reconfigure(void *state, struct audio_desc desc) +static bool audio_play_sdi_reconfigure(void *state, struct audio_desc desc) { - struct state_sdi_playback *s; - s = (struct state_sdi_playback *) state; + struct state_sdi_playback *s = state; if(s->reconfigure_callback) { return s->reconfigure_callback(s->udata, desc.bps * 8, desc.ch_count, desc.sample_rate); - } else { - return FALSE; } + return false; } static void audio_play_sdi_done(void *s) diff --git a/src/audio/playback/sdi.h b/src/audio/playback/sdi.h index d0c2c5b1d6..0155eb306b 100644 --- a/src/audio/playback/sdi.h +++ b/src/audio/playback/sdi.h @@ -3,7 +3,7 @@ * @author Martin Pulec */ /* - * Copyright (c) 2012-2015 CESNET, z. s. p. o. + * Copyright (c) 2012-2023 CESNET, z. s. p. o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -36,13 +36,19 @@ */ #ifdef __cplusplus +#include extern "C" { -#endif +#else +#include +#include + #endif + +struct audio_frame; -void sdi_register_display_callbacks(void *state, void *udata, void (*putf)(void *, const struct audio_frame *), - int (*reconfigure)(void *, int, int, int), - int (*get_property)(void *, int, void *, size_t *) - ); + void sdi_register_display_callbacks( + void *state, void *udata, void (*putf)(void *, const struct audio_frame *), + bool (*reconfigure)(void *, int, int, int), + bool (*get_property)(void *, int, void *, size_t *)); #ifdef __cplusplus } diff --git a/src/audio/playback/wasapi.cpp b/src/audio/playback/wasapi.cpp index 8421d02dfd..b454db1067 100644 --- a/src/audio/playback/wasapi.cpp +++ b/src/audio/playback/wasapi.cpp @@ -335,8 +335,8 @@ static bool audio_play_wasapi_ctl(void *state, int request, void *data, size_t * } } -#define FAIL_IF_NOT(cmd) do {HRESULT hr = cmd; if (hr != S_OK) { LOG(LOG_LEVEL_ERROR) << MOD_NAME << #cmd << ": " << hresult_to_str(hr) << "\n"; return FALSE;}} while(0) -static int audio_play_wasapi_reconfigure(void *state, struct audio_desc desc) +#define FAIL_IF_NOT(cmd) do {HRESULT hr = cmd; if (hr != S_OK) { LOG(LOG_LEVEL_ERROR) << MOD_NAME << #cmd << ": " << hresult_to_str(hr) << "\n"; return false;}} while(0) +static bool audio_play_wasapi_reconfigure(void *state, struct audio_desc desc) { auto s = static_cast(state); int buflen_ms = DEFAULT_WASAPI_BUFLEN_MS; @@ -355,7 +355,7 @@ static int audio_play_wasapi_reconfigure(void *state, struct audio_desc desc) FAIL_IF_NOT(s->pAudioClient->Start()); - return TRUE; + return true; } #define CHECK(cmd) do {HRESULT hr = cmd; if (hr != S_OK) { LOG(LOG_LEVEL_ERROR) << MOD_NAME << #cmd ": " << hresult_to_str(hr) << "\n"; return;}} while(0) diff --git a/src/main.cpp b/src/main.cpp index d84a96cb3f..f8e23415c3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1514,8 +1514,8 @@ int main(int argc, char *argv[]) audio_register_display_callbacks(uv.audio, uv.display_device, (void (*)(void *, const struct audio_frame *)) display_put_audio_frame, - (int (*)(void *, int, int, int)) display_reconfigure_audio, - (int (*)(void *, int, void *, size_t *)) display_ctl_property); + (bool (*)(void *, int, int, int)) display_reconfigure_audio, + (bool (*)(void *, int, void *, size_t *)) display_ctl_property); } if (opt.requested_capabilities != nullptr) { diff --git a/src/video_capture/ug_input.cpp b/src/video_capture/ug_input.cpp index 4787efa523..beddd9b4e6 100644 --- a/src/video_capture/ug_input.cpp +++ b/src/video_capture/ug_input.cpp @@ -166,8 +166,8 @@ static int vidcap_ug_input_init(struct vidcap_params *cap_params, void **state) audio_register_display_callbacks(s->audio, s->display, (void (*)(void *, const struct audio_frame *)) display_put_audio_frame, - (int (*)(void *, int, int, int)) display_reconfigure_audio, - (int (*)(void *, int, void *, size_t *)) display_ctl_property); + (bool (*)(void *, int, int, int)) display_reconfigure_audio, + (bool (*)(void *, int, void *, size_t *)) display_ctl_property); audio_start(s->audio); } diff --git a/src/video_display.c b/src/video_display.c index cea85d0f2a..8da8067c93 100644 --- a/src/video_display.c +++ b/src/video_display.c @@ -403,16 +403,14 @@ bool display_put_frame(struct display *d, struct video_frame *frame, long long t * * @param d display to be reconfigured * @param desc new video description to be reconfigured to - * @retval TRUE if reconfiguration succeeded - * @retval FALSE if reconfiguration failed */ -int display_reconfigure(struct display *d, struct video_desc desc, enum video_mode video_mode) +bool display_reconfigure(struct display *d, struct video_desc desc, enum video_mode video_mode) { assert(d->magic == DISPLAY_MAGIC); d->saved_desc = desc; d->saved_mode = video_mode; - int rc = 0; + bool rc = false; struct video_desc display_desc = desc; if (d->postprocess) { @@ -494,10 +492,8 @@ static void restrict_returned_codecs(codec_t *display_codecs, * @param[in] val pointer to output buffer where should be the property stored * @param[in] len provided buffer length * @param[out] len actual size written - * @retval TRUE if succeeded and result is contained in val and len - * @retval FALSE if the query didn't succeeded (either not supported or error) */ -int display_ctl_property(struct display *d, int property, void *val, size_t *len) +bool display_ctl_property(struct display *d, int property, void *val, size_t *len) { assert(d->magic == DISPLAY_MAGIC); if (d->postprocess) { @@ -505,7 +501,7 @@ int display_ctl_property(struct display *d, int property, void *val, size_t *len case DISPLAY_PROPERTY_BUF_PITCH: *(int *) val = PITCH_DEFAULT; *len = sizeof(int); - return TRUE; + return true; case DISPLAY_PROPERTY_CODECS: { codec_t display_codecs[VIDEO_CODEC_COUNT]; @@ -517,7 +513,7 @@ int display_ctl_property(struct display *d, int property, void *val, size_t *len ret = d->funcs->ctl_property(d->state, DISPLAY_PROPERTY_CODECS, display_codecs, &nlen); if (!ret) { log_msg(LOG_LEVEL_ERROR, "[Display] Unable to get display supported codecs.\n"); - return FALSE; + return false; } display_codecs_count = nlen / sizeof(codec_t); nlen = sizeof pp_codecs; @@ -525,7 +521,7 @@ int display_ctl_property(struct display *d, int property, void *val, size_t *len if (ret) { if (nlen == 0) { // problem detected log_msg(LOG_LEVEL_ERROR, "[Decoder] Unable to get supported codecs.\n"); - return FALSE; + return false; } pp_codecs_count = nlen / sizeof(codec_t); @@ -536,10 +532,9 @@ int display_ctl_property(struct display *d, int property, void *val, size_t *len if (nlen <= *len) { *len = nlen; memcpy(val, display_codecs, nlen); - return TRUE; - } else { - return FALSE; + return true; } + return false; } break; default: @@ -571,7 +566,7 @@ void display_put_audio_frame(struct display *d, const struct audio_frame *frame) * @retval TRUE if reconfiguration succeeded * @retval FALSE if reconfiguration failed */ -int display_reconfigure_audio(struct display *d, int quant_samples, int channels, int sample_rate) +bool display_reconfigure_audio(struct display *d, int quant_samples, int channels, int sample_rate) { assert(d->magic == DISPLAY_MAGIC); if (!d->funcs->reconfigure_audio) { diff --git a/src/video_display.h b/src/video_display.h index 3e7a573249..f612efb201 100644 --- a/src/video_display.h +++ b/src/video_display.h @@ -143,7 +143,7 @@ enum display_prop_vid_mode { }; /// @} -#define VIDEO_DISPLAY_ABI_VERSION 20 +#define VIDEO_DISPLAY_ABI_VERSION 21 #define DISPLAY_NO_GENERIC_FPS_INDICATOR ((const char *) 0x00) @@ -155,10 +155,10 @@ struct video_display_info { struct video_frame *(*getf) (void *state); /// @param timeout_ns display is supposed immplement the PUTF_* macros, numerical timeout is seldom used (but double-framerate postprocess can use that) bool (*putf) (void *state, struct video_frame *frame, long long timeout_ns); - int (*reconfigure_video)(void *state, struct video_desc desc); - int (*ctl_property)(void *state, int property, void *val, size_t *len); + bool (*reconfigure_video)(void *state, struct video_desc desc); + bool (*ctl_property)(void *state, int property, void *val, size_t *len); void (*put_audio_frame) (void *state, const struct audio_frame *frame); ///< may be NULL - int (*reconfigure_audio) (void *state, int quant_samples, int channels, ///< may be NULL + bool (*reconfigure_audio) (void *state, int quant_samples, int channels, ///< may be NULL int sample_rate); const char *generic_fps_indicator_prefix; ///< NO_GENERIC_FPS_INDICATOR or pointer to preferred module name }; @@ -190,12 +190,10 @@ struct video_frame *display_get_frame(struct display *d); // documented at definition bool display_put_frame(struct display *d, struct video_frame *frame, long long timeout_ns); -int display_reconfigure(struct display *d, struct video_desc desc, enum video_mode mode); +bool display_reconfigure(struct display *d, struct video_desc desc, enum video_mode mode); /** @brief Get/set property (similar to ioctl) - * @retval TRUE if succeeds - * @retval FALSE if fails */ -int display_ctl_property(struct display *d, int property, void *val, size_t *len); +bool display_ctl_property(struct display *d, int property, void *val, size_t *len); /** * @defgroup display_audio Audio * Audio related functions (embedded audio). @@ -204,7 +202,7 @@ int display_ctl_property(struct display *d, int property, v * @{ */ void display_put_audio_frame(struct display *d, const struct audio_frame *frame); -int display_reconfigure_audio(struct display *d, int quant_samples, int channels, int sample_rate); +bool display_reconfigure_audio(struct display *d, int quant_samples, int channels, int sample_rate); /** @} */ // end of display_audio struct video_frame *get_splashscreen(void); diff --git a/src/video_display/aggregate.c b/src/video_display/aggregate.c index 7564ff0274..105af52b57 100644 --- a/src/video_display/aggregate.c +++ b/src/video_display/aggregate.c @@ -235,11 +235,11 @@ static bool display_aggregate_putf(void *state, struct video_frame *frame, long return true; } -static int display_aggregate_reconfigure(void *state, struct video_desc desc) +static bool display_aggregate_reconfigure(void *state, struct video_desc desc) { struct display_aggregate_state *s = (struct display_aggregate_state *)state; unsigned int i; - int ret = FALSE; + bool ret = false; assert(s->magic == MAGIC_AGGREGATE); @@ -257,7 +257,7 @@ static int display_aggregate_reconfigure(void *state, struct video_desc desc) return ret; } -static int display_aggregate_get_property(void *state, int property, void *val, size_t *len) +static bool display_aggregate_get_property(void *state, int property, void *val, size_t *len) { struct display_aggregate_state *s = (struct display_aggregate_state *)state; unsigned int i; @@ -308,14 +308,14 @@ static int display_aggregate_get_property(void *state, int property, void *val, } free(codecs); free(lens); - return TRUE; + return true; err_codecs: for(i = 0; i < s->devices_cnt; ++i) { free(codecs[i]); } free(codecs); free(lens); - return FALSE; + return false; } break; case DISPLAY_PROPERTY_RGB_SHIFT: @@ -340,9 +340,9 @@ static int display_aggregate_get_property(void *state, int property, void *val, goto err; *len = first_size; memcpy(val, first_val, first_size); - return TRUE; + return true; err: - return FALSE; + return false; } case DISPLAY_PROPERTY_VIDEO_MODE: @@ -353,9 +353,9 @@ static int display_aggregate_get_property(void *state, int property, void *val, break; default: - return FALSE; + return false; } - return TRUE; + return true; } static void display_aggregate_put_audio_frame(void *state, const struct audio_frame *frame) @@ -373,7 +373,7 @@ static void display_aggregate_put_audio_frame(void *state, const struct audio_fr display_put_audio_frame(s->devices[0], frame); } -static int display_aggregate_reconfigure_audio(void *state, int quant_samples, int channels, +static bool display_aggregate_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { struct display_aggregate_state *s = (struct display_aggregate_state *)state; diff --git a/src/video_display/aja.cpp b/src/video_display/aja.cpp index cc063eedf8..f64b28b2ec 100644 --- a/src/video_display/aja.cpp +++ b/src/video_display/aja.cpp @@ -860,7 +860,7 @@ static NTV2VideoFormat display_aja_get_first_matching_video_format(const NTV2Fra } -LINK_SPEC int display_aja_reconfigure(void *state, struct video_desc desc) +LINK_SPEC bool display_aja_reconfigure(void *state, struct video_desc desc) { auto s = static_cast(state); if (s->desc.color_spec != VIDEO_CODEC_NONE) { @@ -870,7 +870,7 @@ LINK_SPEC int display_aja_reconfigure(void *state, struct video_desc desc) if (desc.tile_count != 1 && desc.tile_count != 4) { LOG(LOG_LEVEL_ERROR) << MODULE_NAME "Unsupported tile count: " << desc.tile_count << "\n"; - return FALSE; + return false; } bool interlaced = desc.interlacing == INTERLACED_MERGED; @@ -888,7 +888,7 @@ LINK_SPEC int display_aja_reconfigure(void *state, struct video_desc desc) ": " << desc #endif << "\n"; - return FALSE; + return false; } s->mPixelFormat = NTV2_FBF_INVALID; for (auto & c : aja::codec_map) { @@ -905,12 +905,12 @@ LINK_SPEC int display_aja_reconfigure(void *state, struct video_desc desc) } catch (runtime_error &e) { LOG(LOG_LEVEL_ERROR) << MODULE_NAME "Reconfiguration failed: " << e.what() << "\n"; s->desc = {}; - return FALSE; + return false; } s->worker = thread(&aja::display::process_frames, s); - return TRUE; + return true; } LINK_SPEC void *display_aja_init(struct module * /* parent */, const char *fmt, unsigned int flags) @@ -1016,7 +1016,7 @@ LINK_SPEC bool display_aja_putf(void *state, struct video_frame *frame, long lon return s->Putf(frame, nonblock); } -LINK_SPEC int display_aja_get_property(void *state, int property, void *val, size_t *len) +LINK_SPEC bool display_aja_get_property(void *state, int property, void *val, size_t *len) { auto s = static_cast(state); @@ -1035,7 +1035,7 @@ LINK_SPEC int display_aja_get_property(void *state, int property, void *val, siz *len = count * sizeof(codec_t); memcpy(val, codecs.data(), *len); } else { - return FALSE; + return false; } break; case DISPLAY_PROPERTY_AUDIO_FORMAT: @@ -1054,13 +1054,13 @@ LINK_SPEC int display_aja_get_property(void *state, int property, void *val, siz *(int *) val = DISPLAY_PROPERTY_VIDEO_SEPARATE_TILES; *len = sizeof(int); } else { - return FALSE; + return false; } break; default: - return FALSE; + return false; } - return TRUE; + return true; } LINK_SPEC void display_aja_put_audio_frame(void *state, const struct audio_frame *frame) @@ -1078,7 +1078,7 @@ LINK_SPEC void display_aja_put_audio_frame(void *state, const struct audio_frame s->mAudioLen += len; } -LINK_SPEC int display_aja_reconfigure_audio(void *state, int quant_samples, int channels, +LINK_SPEC bool display_aja_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { auto s = static_cast(state); @@ -1088,10 +1088,10 @@ LINK_SPEC int display_aja_reconfigure_audio(void *state, int quant_samples, int if (AJA_FAILURE(status)) { ostringstream oss; oss << "Unable to initialize audio: " << AJAStatusToString(status); - return FALSE; + return false; } - return TRUE; + return true; } #ifndef _MSC_VER diff --git a/src/video_display/blend.cpp b/src/video_display/blend.cpp index b9a80afeff..7102256beb 100644 --- a/src/video_display/blend.cpp +++ b/src/video_display/blend.cpp @@ -366,7 +366,7 @@ static bool display_blend_putf(void *state, struct video_frame *frame, long long return true; } -static int display_blend_get_property(void *state, int property, void *val, size_t *len) +static bool display_blend_get_property(void *state, int property, void *val, size_t *len) { shared_ptr s = ((struct state_blend *)state)->common; if (property == DISPLAY_PROPERTY_SUPPORTS_MULTI_SOURCES) { @@ -374,20 +374,18 @@ static int display_blend_get_property(void *state, int property, void *val, size ((struct multi_sources_supp_info *) val)->fork_display = display_blend_fork; ((struct multi_sources_supp_info *) val)->state = state; *len = sizeof(struct multi_sources_supp_info); - return TRUE; - - } else { - return display_ctl_property(s->real_display, property, val, len); + return true; } + return display_ctl_property(s->real_display, property, val, len); } -static int display_blend_reconfigure(void *state, struct video_desc desc) +static bool display_blend_reconfigure(void *state, struct video_desc desc) { struct state_blend *s = (struct state_blend *) state; s->desc = desc; - return 1; + return true; } static void display_blend_put_audio_frame(void *state, const struct audio_frame *frame) @@ -396,7 +394,7 @@ static void display_blend_put_audio_frame(void *state, const struct audio_frame UNUSED(frame); } -static int display_blend_reconfigure_audio(void *state, int quant_samples, int channels, +static bool display_blend_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { UNUSED(state); @@ -404,7 +402,7 @@ static int display_blend_reconfigure_audio(void *state, int quant_samples, int c UNUSED(channels); UNUSED(sample_rate); - return FALSE; + return false; } static void display_blend_probe(struct device_info **available_cards, int *count, void (**deleter)(void *)) { diff --git a/src/video_display/bluefish444.cpp b/src/video_display/bluefish444.cpp index 8eba22702b..486c524fe5 100644 --- a/src/video_display/bluefish444.cpp +++ b/src/video_display/bluefish444.cpp @@ -903,22 +903,20 @@ static bool display_bluefish444_putf(void *state, struct video_frame *frame, lon return false; } -static int +static bool display_bluefish444_reconfigure(void *state, struct video_desc desc) { display_bluefish444_state *s = (display_bluefish444_state *) state; - int ret; try { s->reconfigure(desc); - ret = TRUE; } catch(runtime_error &e) { cerr << "[Blue444 disp] " << e.what() << endl; - ret = FALSE; + return false; } - return ret; + return true; } static void display_bluefish444_done(void *state) @@ -929,7 +927,7 @@ static void display_bluefish444_done(void *state) delete s; } -static int display_bluefish444_get_property(void *state, int property, void *val, size_t *len) +static bool display_bluefish444_get_property(void *state, int property, void *val, size_t *len) { UNUSED(state); codec_t codecs[] = { UYVY }; @@ -941,14 +939,14 @@ static int display_bluefish444_get_property(void *state, int property, void *val if(sizeof(codecs) <= *len) { memcpy(val, codecs, sizeof(codecs)); } else { - return FALSE; + return false; } *len = sizeof(codecs); break; case DISPLAY_PROPERTY_RGB_SHIFT: if(sizeof(rgb_shift) > *len) { - return FALSE; + return false; } memcpy(val, rgb_shift, sizeof(rgb_shift)); *len = sizeof(rgb_shift); @@ -961,7 +959,7 @@ static int display_bluefish444_get_property(void *state, int property, void *val if(sizeof(supported_il_modes) <= *len) { memcpy(val, supported_il_modes, sizeof(supported_il_modes)); } else { - return FALSE; + return false; } *len = sizeof(supported_il_modes); break; @@ -979,12 +977,12 @@ static int display_bluefish444_get_property(void *state, int property, void *val } break; default: - return FALSE; + return false; } - return TRUE; + return true; } -static int display_bluefish444_reconfigure_audio(void *state, int quant_samples, int channels, +static bool display_bluefish444_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { #ifdef HAVE_BLUE_AUDIO @@ -994,15 +992,14 @@ static int display_bluefish444_reconfigure_audio(void *state, int quant_samples, try { s->reconfigure_audio(quant_samples, channels, sample_rate); - ret = TRUE; } catch(runtime_error &e) { cerr << "[Blue444 disp] " << e.what() << endl; - ret = FALSE; + return false; } - return ret; + return true; #else - return FALSE; + return false; #endif } diff --git a/src/video_display/caca.c b/src/video_display/caca.c index 8a5326cebb..bb681aca7e 100644 --- a/src/video_display/caca.c +++ b/src/video_display/caca.c @@ -282,7 +282,7 @@ static bool display_caca_putf(void *state, struct video_frame *frame, long long return true; } -static int display_caca_get_property(void *state, int property, void *val, size_t *len) +static bool display_caca_get_property(void *state, int property, void *val, size_t *len) { UNUSED(state); @@ -290,16 +290,16 @@ static int display_caca_get_property(void *state, int property, void *val, size_ if (property == DISPLAY_PROPERTY_CODECS && sizeof c <= *len) { memcpy(val, c, sizeof c); *len = sizeof c; - return TRUE; + return true; } - return FALSE; + return false; } -static int display_caca_reconfigure(void *state, struct video_desc desc) +static bool display_caca_reconfigure(void *state, struct video_desc desc) { struct state_caca *s = state; s->desc = desc; - return TRUE; + return true; } static const void *display_caca_info_get() { diff --git a/src/video_display/conference.cpp b/src/video_display/conference.cpp index 3f00f5c442..bef89003ba 100644 --- a/src/video_display/conference.cpp +++ b/src/video_display/conference.cpp @@ -644,7 +644,7 @@ static void display_conference_run(void *state) worker.join(); } -static int display_conference_get_property(void *state, int property, void *val, size_t *len) +static bool display_conference_get_property(void *state, int property, void *val, size_t *len) { auto s = ((struct state_conference *)state)->common; if (property == DISPLAY_PROPERTY_SUPPORTS_MULTI_SOURCES) { @@ -652,7 +652,7 @@ static int display_conference_get_property(void *state, int property, void *val, ((struct multi_sources_supp_info *) val)->fork_display = display_conference_fork; ((struct multi_sources_supp_info *) val)->state = state; *len = sizeof(struct multi_sources_supp_info); - return TRUE; + return true; } else if(property == DISPLAY_PROPERTY_CODECS) { codec_t codecs[] = {UYVY}; @@ -661,7 +661,7 @@ static int display_conference_get_property(void *state, int property, void *val, *len = sizeof(codecs); - return TRUE; + return true; } return display_ctl_property(s->real_display.get(), property, val, len); @@ -673,7 +673,7 @@ static int display_conference_reconfigure(void *state, struct video_desc desc) s->desc = desc; - return 1; + return true; } static void display_conference_put_audio_frame(void *state, const struct audio_frame *frame) @@ -682,7 +682,7 @@ static void display_conference_put_audio_frame(void *state, const struct audio_f UNUSED(frame); } -static int display_conference_reconfigure_audio(void *state, int quant_samples, int channels, +static bool display_conference_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { UNUSED(state); @@ -690,7 +690,7 @@ static int display_conference_reconfigure_audio(void *state, int quant_samples, UNUSED(channels); UNUSED(sample_rate); - return FALSE; + return false; } static void display_conference_done(void *state) diff --git a/src/video_display/decklink.cpp b/src/video_display/decklink.cpp index 8eea0a4fb7..c1269b7ccd 100644 --- a/src/video_display/decklink.cpp +++ b/src/video_display/decklink.cpp @@ -96,7 +96,7 @@ enum { static void print_output_modes(IDeckLink *); static void display_decklink_done(void *state); -static int display_decklink_reconfigure(void *state, struct video_desc desc); +static bool display_decklink_reconfigure(void *state, struct video_desc desc); // performs command, if failed, displays error and jumps to error label #define EXIT_IF_FAILED(cmd, name) \ @@ -823,7 +823,7 @@ static int enable_audio(struct state_decklink *s, int bps, int channels) return TRUE; } -static int +static bool display_decklink_reconfigure(void *state, struct video_desc desc) { struct state_decklink *s = (struct state_decklink *)state; @@ -866,7 +866,7 @@ display_decklink_reconfigure(void *state, struct video_desc desc) [&desc](const std::pair& el){ return el.first == desc.color_spec; }); if (it == uv_to_bmd_codec_map.end()) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "Unsupported pixel format!\n"); - return FALSE; + return false; } s->pixelFormat = it->second; @@ -883,7 +883,7 @@ display_decklink_reconfigure(void *state, struct video_desc desc) if ((int) desc.tile_count != 2) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "In stereo mode exactly " "2 streams expected, %d received.\n", desc.tile_count); - return FALSE; + return false; } } else { if ((int) desc.tile_count == 2) { @@ -899,7 +899,7 @@ display_decklink_reconfigure(void *state, struct video_desc desc) &s->delegate.frameRateScale, s->stereo); if (displayMode == bmdModeUnknown) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "Could not find suitable video mode.\n"); - return FALSE; + return false; } if (s->emit_timecode) { @@ -970,7 +970,7 @@ display_decklink_reconfigure(void *state, struct video_desc desc) "combination not supported - %d * %dx%d@%f, timecode %s.\n", desc.tile_count, desc.width, desc.height, desc.fps, (outputFlags & bmdVideoOutputRP188 ? "ON" : "OFF")); - return FALSE; + return false; } result = s->deckLinkOutput->EnableVideoOutput(displayMode, outputFlags); @@ -985,12 +985,12 @@ display_decklink_reconfigure(void *state, struct video_desc desc) << MOD_NAME << "EnableVideoOutput: " << bmd_hresult_to_string(result) << "\n"; } - return FALSE; + return false; } if (s->play_audio) { if (!enable_audio(s, s->aud_desc.bps, s->aud_desc.ch_count)) { - return FALSE; + return false; } } @@ -1010,13 +1010,13 @@ display_decklink_reconfigure(void *state, struct video_desc desc) << MOD_NAME << "StartScheduledPlayback (video): " << bmd_hresult_to_string(result) << "\n"; s->deckLinkOutput->DisableVideoOutput(); - return FALSE; + return false; } } s->initialized = true; s->audio_reconfigure = false; - return TRUE; + return true; } static void display_decklink_probe(struct device_info **available_cards, int *count, void (**deleter)(void *)) @@ -1500,7 +1500,7 @@ static bool decklink_display_supports_codec(IDeckLinkOutput *deckLinkOutput, BMD return false; } -static int display_decklink_get_property(void *state, int property, void *val, size_t *len) +static bool display_decklink_get_property(void *state, int property, void *val, size_t *len) { struct state_decklink *s = (struct state_decklink *)state; vector codecs(uv_to_bmd_codec_map.size()); @@ -1519,12 +1519,12 @@ static int display_decklink_get_property(void *state, int property, void *val, s memcpy(val, codecs.data(), sizeof(codec_t) * count); *len = sizeof(codec_t) * count; } else { - return FALSE; + return false; } break; case DISPLAY_PROPERTY_RGB_SHIFT: if(sizeof(rgb_shift) > *len) { - return FALSE; + return false; } memcpy(val, rgb_shift, sizeof(rgb_shift)); *len = sizeof(rgb_shift); @@ -1541,7 +1541,7 @@ static int display_decklink_get_property(void *state, int property, void *val, s if(sizeof(supported_il_modes) <= *len) { memcpy(val, supported_il_modes, sizeof(supported_il_modes)); } else { - return FALSE; + return false; } *len = sizeof(supported_il_modes); break; @@ -1562,9 +1562,9 @@ static int display_decklink_get_property(void *state, int property, void *val, s } break; default: - return FALSE; + return false; } - return TRUE; + return true; } /* @@ -1653,7 +1653,7 @@ static void display_decklink_put_audio_frame(void *state, const struct audio_fra s->audio_drift_fixer.update(buffered, sampleFrameCount, sampleFramesWritten); } -static int display_decklink_reconfigure_audio(void *state, int quant_samples, int channels, +static bool display_decklink_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { struct state_decklink *s = (struct state_decklink *)state; @@ -1663,7 +1663,7 @@ static int display_decklink_reconfigure_audio(void *state, int quant_samples, in channels != 16) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "requested channel count isn't supported: " "%d\n", channels); - return FALSE; + return false; } if((quant_samples != 16 && quant_samples != 32) || @@ -1671,7 +1671,7 @@ static int display_decklink_reconfigure_audio(void *state, int quant_samples, in log_msg(LOG_LEVEL_ERROR, MOD_NAME "audio format isn't supported: " "samples: %d, sample rate: %d\n", quant_samples, sample_rate); - return FALSE; + return false; } const int bps = quant_samples / 8; @@ -1686,7 +1686,7 @@ static int display_decklink_reconfigure_audio(void *state, int quant_samples, in << "\n"; } - return TRUE; + return true; } #ifndef WIN32 diff --git a/src/video_display/deltacast.cpp b/src/video_display/deltacast.cpp index d2556ce0bb..6dc8e6c56a 100644 --- a/src/video_display/deltacast.cpp +++ b/src/video_display/deltacast.cpp @@ -181,7 +181,7 @@ static bool display_deltacast_putf(void *state, struct video_frame *frame, long return true; } -static int +static bool display_deltacast_reconfigure(void *state, struct video_desc desc) { struct state_deltacast *s = (struct state_deltacast *)state; @@ -246,10 +246,10 @@ display_deltacast_reconfigure(void *state, struct video_desc desc) } s->initialized = TRUE; - return TRUE; + return true; error: - return FALSE; + return false; } static void display_deltacast_probe(struct device_info **available_cards, int *count, void (**deleter)(void *)) @@ -427,7 +427,9 @@ static void display_deltacast_done(void *state) free(s); } -static int display_deltacast_get_property(void *state, int property, void *val, size_t *len) +static bool +display_deltacast_get_property(void *state, int property, void *val, + size_t *len) { UNUSED(state); codec_t codecs[] = {v210, UYVY, RAW}; @@ -439,14 +441,14 @@ static int display_deltacast_get_property(void *state, int property, void *val, if(sizeof(codecs) <= *len) { memcpy(val, codecs, sizeof(codecs)); } else { - return FALSE; + return false; } *len = sizeof(codecs); break; case DISPLAY_PROPERTY_RGB_SHIFT: if(sizeof(rgb_shift) > *len) { - return FALSE; + return false; } memcpy(val, rgb_shift, sizeof(rgb_shift)); *len = sizeof(rgb_shift); @@ -459,7 +461,7 @@ static int display_deltacast_get_property(void *state, int property, void *val, if(sizeof(supported_il_modes) <= *len) { memcpy(val, supported_il_modes, sizeof(supported_il_modes)); } else { - return FALSE; + return false; } *len = sizeof(supported_il_modes); break; @@ -474,13 +476,14 @@ static int display_deltacast_get_property(void *state, int property, void *val, } break; default: - return FALSE; + return false; } - return TRUE; + return true; } -static int display_deltacast_reconfigure_audio(void *state, int quant_samples, int channels, - int sample_rate) +static bool +display_deltacast_reconfigure_audio(void *state, int quant_samples, + int channels, int sample_rate) { struct state_deltacast *s = (struct state_deltacast *)state; int i; @@ -523,7 +526,7 @@ static int display_deltacast_reconfigure_audio(void *state, int quant_samples, i default: log_msg(LOG_LEVEL_ERROR, "[DELTACAST] Unsupported PCM audio: %d bits.\n", quant_samples); pthread_mutex_unlock(&s->lock); - return FALSE; + return false; } pAudioChn->pData = new BYTE[s->audio_desc.bps * s->audio_desc.sample_rate]; } @@ -531,7 +534,7 @@ static int display_deltacast_reconfigure_audio(void *state, int quant_samples, i s->audio_configured = TRUE; pthread_mutex_unlock(&s->lock); - return TRUE; + return true; } static void display_deltacast_put_audio_frame(void *state, const struct audio_frame *frame) diff --git a/src/video_display/dummy.c b/src/video_display/dummy.c index f9b82a9daa..6883dd4e4c 100644 --- a/src/video_display/dummy.c +++ b/src/video_display/dummy.c @@ -237,7 +237,7 @@ static bool display_dummy_putf(void *state, struct video_frame *frame, long long return true; } -static int display_dummy_get_property(void *state, int property, void *val, size_t *len) +static bool display_dummy_get_property(void *state, int property, void *val, size_t *len) { struct dummy_display_state *s = state; @@ -246,7 +246,7 @@ static int display_dummy_get_property(void *state, int property, void *val, size { size_t req_len = s->codec_count * sizeof(codec_t); if (req_len > *len) { - return FALSE; + return false; } *len = req_len; memcpy(val, s->codecs, *len); @@ -254,24 +254,24 @@ static int display_dummy_get_property(void *state, int property, void *val, size break; case DISPLAY_PROPERTY_RGB_SHIFT: if (sizeof s->rgb_shift > *len) { - return FALSE; + return false; } *len = sizeof s->rgb_shift; memcpy(val, s->rgb_shift, *len); break; default: - return FALSE; + return false; } - return TRUE; + return true; } -static int display_dummy_reconfigure(void *state, struct video_desc desc) +static bool display_dummy_reconfigure(void *state, struct video_desc desc) { struct dummy_display_state *s = state; vf_free(s->f); s->f = vf_alloc_desc_data(desc); - return TRUE; + return true; } static void display_dummy_probe(struct device_info **available_cards, int *count, void (**deleter)(void *)) { diff --git a/src/video_display/dump.c b/src/video_display/dump.c index 9dab5c98ce..1a6ee820b2 100644 --- a/src/video_display/dump.c +++ b/src/video_display/dump.c @@ -126,7 +126,7 @@ static bool display_dump_putf(void *state, struct video_frame *frame, long long return true; } -static int display_dump_get_property(void *state, int property, void *val, size_t *len) +static bool display_dump_get_property(void *state, int property, void *val, size_t *len) { (void) state; codec_t codecs[VIDEO_CODEC_COUNT - 1]; @@ -149,12 +149,12 @@ static int display_dump_get_property(void *state, int property, void *val, size_ *len = sizeof(int); break; default: - return FALSE; + return false; } - return TRUE; + return true; } -static int display_dump_reconfigure(void *state, struct video_desc desc) +static bool display_dump_reconfigure(void *state, struct video_desc desc) { struct dump_display_state *s = state; vf_free(s->f); @@ -169,7 +169,7 @@ static int display_dump_reconfigure(void *state, struct video_desc desc) } s->f->callbacks.data_deleter = vf_data_deleter; - return TRUE; + return true; } static void display_dump_probe(struct device_info **available_cards, int *count, void (**deleter)(void *)) { diff --git a/src/video_display/dvs.c b/src/video_display/dvs.c index f0b9ffd51a..0b596f4bf3 100644 --- a/src/video_display/dvs.c +++ b/src/video_display/dvs.c @@ -9,7 +9,7 @@ * Ian Wesley-Smith * Colin Perkins * - * Copyright (c) 2005-2021 CESNET z.s.p.o. + * Copyright (c) 2005-2023 CESNET z.s.p.o. * Copyright (c) 2001-2003 University of Southern California * * Redistribution and use in source and binary forms, with or without @@ -531,7 +531,7 @@ static bool display_dvs_putf(void *state, struct video_frame *frame, long long f return true; } -static int display_dvs_reconfigure(void *state, +static bool display_dvs_reconfigure(void *state, struct video_desc desc) { struct state_hdsp *s = (struct state_hdsp *)state; @@ -547,7 +547,7 @@ static int display_dvs_reconfigure(void *state, s->tile->width = desc.width; s->tile->height = desc.height; - if(s->mode_set_manually) return TRUE; + if(s->mode_set_manually) return true; s->mode = NULL; for(i=0; hdsp_mode_table[i].width != 0; i++) { @@ -568,7 +568,7 @@ static int display_dvs_reconfigure(void *state, "\tRequested: %dx%d, color space %d, fps %f,%s\n", desc.width, desc.height, desc.color_spec, desc.fps, get_interlacing_description(desc.interlacing)); - return FALSE; + return false; } hd_video_mode = SV_MODE_STORAGE_FRAME; @@ -588,7 +588,7 @@ static int display_dvs_reconfigure(void *state, break; default: fprintf(stderr, "[dvs] Unsupported video codec passed!"); - return FALSE; + return false; } hd_video_mode |= s->mode->mode; @@ -601,13 +601,13 @@ static int display_dvs_reconfigure(void *state, res = sv_option(s->sv, SV_OPTION_VIDEOMODE, hd_video_mode); if (res != SV_OK) { fprintf(stderr, "Cannot set videomode %s\n", sv_geterrortext(res)); - return FALSE; + return false; } res = sv_sync_output(s->sv, SV_SYNCOUT_BILEVEL); if (res != SV_OK) { fprintf(stderr, "Cannot enable sync-on-green %s\n", sv_geterrortext(res)); - return FALSE; + return false; } @@ -619,13 +619,13 @@ static int display_dvs_reconfigure(void *state, if (res != SV_OK) { fprintf(stderr, "Cannot initialize video display FIFO %s\n", sv_geterrortext(res)); - return FALSE; + return false; } res = sv_fifo_start(s->sv, s->fifo); if (res != SV_OK) { fprintf(stderr, "Cannot start video display FIFO %s\n", sv_geterrortext(res)); - return FALSE; + return false; } s->tile->data_len = vc_get_linesize(s->tile->width, desc.color_spec) * @@ -642,7 +642,7 @@ static int display_dvs_reconfigure(void *state, if(!s->first_run) display_dvs_getf(s); /* update s->frame.data */ - return TRUE; + return true; } static void display_dvs_probe(struct device_info **available_cards, int *count, void (**deleter)(void *)) @@ -821,7 +821,7 @@ static void display_dvs_done(void *state) free(s); } -static int display_dvs_get_property(void *state, int property, void *val, size_t *len) +static bool display_dvs_get_property(void *state, int property, void *val, size_t *len) { codec_t codecs[] = {DVS10, UYVY, RGBA, RGB}; int rgb_shift[] = {0, 8, 16}; @@ -833,14 +833,14 @@ static int display_dvs_get_property(void *state, int property, void *val, size_t if(sizeof(codecs) <= *len) { memcpy(val, codecs, sizeof(codecs)); } else { - return FALSE; + return false; } *len = sizeof(codecs); break; case DISPLAY_PROPERTY_RGB_SHIFT: if(sizeof(rgb_shift) > *len) { - return FALSE; + return false; } memcpy(val, rgb_shift, sizeof(rgb_shift)); *len = sizeof(rgb_shift); @@ -863,9 +863,9 @@ static int display_dvs_get_property(void *state, int property, void *val, size_t } break; default: - return FALSE; + return false; } - return TRUE; + return true; } /* @@ -883,7 +883,7 @@ static void display_dvs_put_audio_frame(void *state, const struct audio_frame *f static int display_dvs_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { - int ret; + bool ret; struct state_hdsp *s = (struct state_hdsp *)state; int res = SV_OK; @@ -956,13 +956,13 @@ static int display_dvs_reconfigure_audio(void *state, int quant_samples, int cha s->audio_reconf_done = FALSE; - ret = TRUE; + ret = true; goto unlock; error: fprintf(stderr, "Setting audio error %s\n", sv_geterrortext(res)); s->play_audio = FALSE; - ret = FALSE; + ret = false; unlock: s->audio_reconf_done = TRUE; diff --git a/src/video_display/gl.cpp b/src/video_display/gl.cpp index e97fcbfab4..a2b1ee5510 100644 --- a/src/video_display/gl.cpp +++ b/src/video_display/gl.cpp @@ -325,7 +325,7 @@ static constexpr array keybindings{ static bool display_gl_init_opengl(struct state_gl *s); static bool display_gl_putf(void *state, struct video_frame *frame, long long timeout); static bool display_gl_process_key(struct state_gl *s, long long int key); -static int display_gl_reconfigure(void *state, struct video_desc desc); +static bool display_gl_reconfigure(void *state, struct video_desc desc); static void gl_draw(double ratio, double bottom_offset, bool double_buf); static void gl_change_aspect(struct state_gl *s, int width, int height); static void gl_resize(GLFWwindow *win, int width, int height); @@ -768,7 +768,8 @@ static void * display_spout_syphon_init(struct module *parent, const char *fmt, /** * This function just sets new video description. */ -static int display_gl_reconfigure(void *state, struct video_desc desc) +static bool +display_gl_reconfigure(void *state, struct video_desc desc) { struct state_gl *s = (struct state_gl *) state; @@ -782,7 +783,7 @@ static int display_gl_reconfigure(void *state, struct video_desc desc) s->current_desc = desc; - return TRUE; + return true; } static void glfw_print_video_mode(struct state_gl *s) { @@ -1853,7 +1854,8 @@ static void glfw_close_callback(GLFWwindow *win) exit_uv(0); } -static int display_gl_get_property(void *state, int property, void *val, size_t *len) +static bool +display_gl_get_property(void *state, int property, void *val, size_t *len) { auto *s = (struct state_gl *) state; enum interlacing_t supported_il_modes[] = {PROGRESSIVE, INTERLACED_MERGED, SEGMENTED_FRAME}; @@ -1873,14 +1875,14 @@ static int display_gl_get_property(void *state, int property, void *val, size_t }; copy_if(gl_supp_codecs.begin(), gl_supp_codecs.end(), (codec_t *) val, filter_codecs); } else { - return FALSE; + return false; } *len = sizeof gl_supp_codecs; break; case DISPLAY_PROPERTY_RGB_SHIFT: if(sizeof(rgb_shift) > *len) { - return FALSE; + return false; } memcpy(val, rgb_shift, sizeof(rgb_shift)); *len = sizeof(rgb_shift); @@ -1893,14 +1895,14 @@ static int display_gl_get_property(void *state, int property, void *val, size_t if(sizeof(supported_il_modes) <= *len) { memcpy(val, supported_il_modes, sizeof(supported_il_modes)); } else { - return FALSE; + return false; } *len = sizeof(supported_il_modes); break; default: - return FALSE; + return false; } - return TRUE; + return true; } static void display_gl_done(void *state) diff --git a/src/video_display/multiplier.cpp b/src/video_display/multiplier.cpp index d075f42a03..8407fa89b2 100644 --- a/src/video_display/multiplier.cpp +++ b/src/video_display/multiplier.cpp @@ -4,7 +4,7 @@ * @author Martin Piatka */ /* - * Copyright (c) 2014-2021 CESNET, z. s. p. o. + * Copyright (c) 2014-2023 CESNET, z. s. p. o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -253,7 +253,7 @@ static bool display_multiplier_putf(void *state, struct video_frame *frame, long return true; } -static int display_multiplier_get_property(void *state, int property, void *val, size_t *len) +static bool display_multiplier_get_property(void *state, int property, void *val, size_t *len) { //TODO Figure out forking, for now just disable multi. sources shared_ptr s = ((struct state_multiplier *)state)->common; @@ -263,16 +263,16 @@ static int display_multiplier_get_property(void *state, int property, void *val, ((struct multi_sources_supp_info *) val)->fork_display = display_multiplier_fork; ((struct multi_sources_supp_info *) val)->state = state; *len = sizeof(struct multi_sources_supp_info); - return TRUE; + return true; #endif - return FALSE; + return false; } //TODO Find common properties, for now just return properties of the first display return display_ctl_property(s->displays[0].get(), property, val, len); } -static int display_multiplier_reconfigure(void *state, struct video_desc desc) +static bool display_multiplier_reconfigure(void *state, struct video_desc desc) { struct state_multiplier *s = (struct state_multiplier *) state; @@ -282,7 +282,7 @@ static int display_multiplier_reconfigure(void *state, struct video_desc desc) display_reconfigure(disp.get(), desc, VIDEO_NORMAL); } - return 1; + return true; } static void display_multiplier_put_audio_frame(void *state, const struct audio_frame *frame) @@ -292,7 +292,7 @@ static void display_multiplier_put_audio_frame(void *state, const struct audio_f display_put_audio_frame(s->common->displays.at(0).get(), frame); } -static int display_multiplier_reconfigure_audio(void *state, int quant_samples, int channels, +static bool display_multiplier_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { auto *s = static_cast(state); diff --git a/src/video_display/ndi.c b/src/video_display/ndi.c index b6f64233a6..a9497ae37e 100644 --- a/src/video_display/ndi.c +++ b/src/video_display/ndi.c @@ -3,7 +3,7 @@ * @author Martin Pulec */ /* - * Copyright (c) 2019-2022 CESNET, z. s. p. o. + * Copyright (c) 2019-2023 CESNET, z. s. p. o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -107,7 +107,7 @@ static const struct { { Y416, NDIlib_FourCC_type_PA16, ndi_disp_convert_Y416_to_PA16 }, }; -static int display_ndi_reconfigure(void *state, struct video_desc desc) +static bool display_ndi_reconfigure(void *state, struct video_desc desc) { struct display_ndi *s = (struct display_ndi *) state; @@ -129,7 +129,7 @@ static int display_ndi_reconfigure(void *state, struct video_desc desc) s->NDI_video_frame.frame_format_type = desc.interlacing == PROGRESSIVE ? NDIlib_frame_format_type_progressive : NDIlib_frame_format_type_interleaved; s->NDI_video_frame.timecode = NDIlib_send_timecode_synthesize; - return TRUE; + return true; } static void usage() @@ -350,7 +350,7 @@ static bool display_ndi_putf(void *state, struct video_frame *frame, long long f return true; } -static int display_ndi_get_property(void *state, int property, void *val, size_t *len) +static bool display_ndi_get_property(void *state, int property, void *val, size_t *len) { UNUSED(state); codec_t codecs[sizeof codec_mapping / sizeof codec_mapping[0]]; @@ -367,12 +367,12 @@ static int display_ndi_get_property(void *state, int property, void *val, size_t memcpy(val, codecs, sizeof codecs); *len = sizeof codecs; } else { - return FALSE; + return false; } break; case DISPLAY_PROPERTY_RGB_SHIFT: if (sizeof rgb_shift > *len) { - return FALSE; + return false; } memcpy(val, rgb_shift, sizeof rgb_shift); *len = sizeof rgb_shift; @@ -389,7 +389,7 @@ static int display_ndi_get_property(void *state, int property, void *val, size_t if (sizeof(supported_il_modes) <= *len) { memcpy(val, supported_il_modes, sizeof(supported_il_modes)); } else { - return FALSE; + return false; } *len = sizeof(supported_il_modes); break; @@ -402,9 +402,9 @@ static int display_ndi_get_property(void *state, int property, void *val, size_t } break; default: - return FALSE; + return false; } - return TRUE; + return true; } #define NDI_SEND_AUDIO(frame, bit_depth) do { \ @@ -432,7 +432,7 @@ static void display_ndi_put_audio_frame(void *state, const struct audio_frame *f } } -static int display_ndi_reconfigure_audio(void *state, int quant_samples, int channels, +static bool display_ndi_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { struct display_ndi *s = (struct display_ndi *) state; @@ -440,7 +440,7 @@ static int display_ndi_reconfigure_audio(void *state, int quant_samples, int cha s->audio_desc.ch_count = channels; s->audio_desc.sample_rate = sample_rate; - return TRUE; + return true; } static const struct video_display_info display_ndi_info = { diff --git a/src/video_display/null.c b/src/video_display/null.c index d3879a04e9..57854e33ca 100644 --- a/src/video_display/null.c +++ b/src/video_display/null.c @@ -101,23 +101,23 @@ static bool display_null_putf(void *state, struct video_frame *frame, long long return true; } -static int display_null_get_property(void *state, int property, void *val, size_t *len) +static bool display_null_get_property(void *state, int property, void *val, size_t *len) { UNUSED(state); UNUSED(property); UNUSED(val); UNUSED(len); - return FALSE; + return false; } -static int display_null_reconfigure(void *state, struct video_desc desc) +static bool display_null_reconfigure(void *state, struct video_desc desc) { UNUSED(desc); struct state_null *s = (struct state_null *)state; assert(s->magic == MAGIC_NULL); - return TRUE; + return true; } static void display_null_put_audio_frame(void *state, const struct audio_frame *frame) @@ -126,7 +126,7 @@ static void display_null_put_audio_frame(void *state, const struct audio_frame * UNUSED(frame); } -static int display_null_reconfigure_audio(void *state, int quant_samples, int channels, +static bool display_null_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { UNUSED(state); @@ -134,7 +134,7 @@ static int display_null_reconfigure_audio(void *state, int quant_samples, int ch UNUSED(channels); UNUSED(sample_rate); - return FALSE; + return false; } static const struct video_display_info display_null_info = { diff --git a/src/video_display/openxr_gl.cpp b/src/video_display/openxr_gl.cpp index 6985403c89..b2ca642cea 100644 --- a/src/video_display/openxr_gl.cpp +++ b/src/video_display/openxr_gl.cpp @@ -3,7 +3,7 @@ * @author Martin Piatka */ /* - * Copyright (c) 2010-2021 CESNET, z. s. p. o. + * Copyright (c) 2010-2023 CESNET, z. s. p. o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -1054,14 +1054,14 @@ static bool display_xrgl_putf(void *state, struct video_frame *frame, long long return true; } -static int display_xrgl_reconfigure(void *state, struct video_desc desc) { +static bool display_xrgl_reconfigure(void *state, struct video_desc desc) { state_xrgl *s = static_cast(state); s->current_desc = desc; - return 1; + return true; } -static int display_xrgl_get_property(void *state, int property, void *val, size_t *len) { +static bool display_xrgl_get_property(void *state, int property, void *val, size_t *len) { UNUSED(state); codec_t codecs[] = { RGBA, @@ -1076,14 +1076,14 @@ static int display_xrgl_get_property(void *state, int property, void *val, size_ if(sizeof(codecs) <= *len) { memcpy(val, codecs, sizeof(codecs)); } else { - return FALSE; + return false; } *len = sizeof(codecs); break; case DISPLAY_PROPERTY_RGB_SHIFT: if(sizeof(rgb_shift) > *len) { - return FALSE; + return false; } memcpy(val, rgb_shift, sizeof(rgb_shift)); *len = sizeof(rgb_shift); @@ -1096,14 +1096,14 @@ static int display_xrgl_get_property(void *state, int property, void *val, size_ if(sizeof(supported_il_modes) <= *len) { memcpy(val, supported_il_modes, sizeof(supported_il_modes)); } else { - return FALSE; + return false; } *len = sizeof(supported_il_modes); break; default: - return FALSE; + return false; } - return TRUE; + return true; } static void display_xrgl_probe(struct device_info **available_cards, int *count, void (**deleter)(void *)){ diff --git a/src/video_display/pano_gl.cpp b/src/video_display/pano_gl.cpp index 9df1a654fe..e5c555ccec 100644 --- a/src/video_display/pano_gl.cpp +++ b/src/video_display/pano_gl.cpp @@ -3,7 +3,7 @@ * @author Martin Piatka */ /* - * Copyright (c) 2010-2021 CESNET, z. s. p. o. + * Copyright (c) 2010-2023 CESNET, z. s. p. o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -305,14 +305,14 @@ static bool display_panogl_putf(void *state, struct video_frame *frame, long lon return true; } -static int display_panogl_reconfigure(void *state, struct video_desc desc) { +static bool display_panogl_reconfigure(void *state, struct video_desc desc) { state_vr *s = static_cast(state); s->current_desc = desc; - return 1; + return true; } -static int display_panogl_get_property(void *state, int property, void *val, size_t *len) { +static bool display_panogl_get_property(void *state, int property, void *val, size_t *len) { UNUSED(state); codec_t codecs[] = { RGBA, @@ -327,14 +327,14 @@ static int display_panogl_get_property(void *state, int property, void *val, siz if(sizeof(codecs) <= *len) { memcpy(val, codecs, sizeof(codecs)); } else { - return FALSE; + return false; } *len = sizeof(codecs); break; case DISPLAY_PROPERTY_RGB_SHIFT: if(sizeof(rgb_shift) > *len) { - return FALSE; + return false; } memcpy(val, rgb_shift, sizeof(rgb_shift)); *len = sizeof(rgb_shift); @@ -347,14 +347,14 @@ static int display_panogl_get_property(void *state, int property, void *val, siz if(sizeof(supported_il_modes) <= *len) { memcpy(val, supported_il_modes, sizeof(supported_il_modes)); } else { - return FALSE; + return false; } *len = sizeof(supported_il_modes); break; default: - return FALSE; + return false; } - return TRUE; + return true; } static void display_panogl_probe(struct device_info **available_cards, int *count, void (**deleter)(void *)) { diff --git a/src/video_display/pipe.cpp b/src/video_display/pipe.cpp index 5e4c6f91cb..09756ef9b2 100644 --- a/src/video_display/pipe.cpp +++ b/src/video_display/pipe.cpp @@ -199,7 +199,7 @@ static bool display_pipe_putf(void *state, struct video_frame *frame, long long return true; } -static int display_pipe_get_property(void *state, int property, void *val, size_t *len) +static bool display_pipe_get_property(void *state, int property, void *val, size_t *len) { auto *s = static_cast(state); enum interlacing_t supported_il_modes[] = {PROGRESSIVE, INTERLACED_MERGED, SEGMENTED_FRAME}; @@ -208,14 +208,14 @@ static int display_pipe_get_property(void *state, int property, void *val, size_ switch (property) { case DISPLAY_PROPERTY_CODECS: if(sizeof(codec_t) > *len) { - return FALSE; + return false; } memcpy(val, &s->decode_to, sizeof(s->decode_to)); *len = sizeof s->decode_to; break; case DISPLAY_PROPERTY_RGB_SHIFT: if(sizeof(rgb_shift) > *len) { - return FALSE; + return false; } memcpy(val, rgb_shift, sizeof(rgb_shift)); *len = sizeof(rgb_shift); @@ -228,7 +228,7 @@ static int display_pipe_get_property(void *state, int property, void *val, size_ if(sizeof(supported_il_modes) <= *len) { memcpy(val, supported_il_modes, sizeof(supported_il_modes)); } else { - return FALSE; + return false; } *len = sizeof(supported_il_modes); break; @@ -250,18 +250,18 @@ static int display_pipe_get_property(void *state, int property, void *val, size_ } break; default: - return FALSE; + return false; } - return TRUE; + return true; } -static int display_pipe_reconfigure(void *state, struct video_desc desc) +static bool display_pipe_reconfigure(void *state, struct video_desc desc) { struct state_pipe *s = (struct state_pipe *) state; s->desc = desc; - return 1; + return true; } static void display_pipe_put_audio_frame(void *state, const struct audio_frame *frame) @@ -271,7 +271,7 @@ static void display_pipe_put_audio_frame(void *state, const struct audio_frame * s->audio_frames.push_back(audio_frame_copy(frame, false)); } -static int display_pipe_reconfigure_audio(void *state, int quant_samples, int channels, +static bool display_pipe_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { UNUSED(state); @@ -279,7 +279,7 @@ static int display_pipe_reconfigure_audio(void *state, int quant_samples, int ch UNUSED(channels); UNUSED(sample_rate); - return TRUE; + return true; } static void display_pipe_probe(struct device_info **available_cards, int *count, void (**deleter)(void *)) { diff --git a/src/video_display/rpi4_out.cpp b/src/video_display/rpi4_out.cpp index 8e6ec9bf3c..98f8e4fb3b 100644 --- a/src/video_display/rpi4_out.cpp +++ b/src/video_display/rpi4_out.cpp @@ -575,7 +575,7 @@ static void display_rpi4_run(void *state) } } -static int display_rpi4_reconfigure(void *state, struct video_desc desc) +static bool display_rpi4_reconfigure(void *state, struct video_desc desc) { auto *s = static_cast(state); @@ -585,7 +585,7 @@ static int display_rpi4_reconfigure(void *state, struct video_desc desc) if(s->force_w == 0 && s->force_h == 0) s->video_out.resize(desc.width, desc.height); - return TRUE; + return true; } static auto display_rpi4_get_property(void *state, int property, void *val, size_t *len) @@ -602,14 +602,14 @@ static auto display_rpi4_get_property(void *state, int property, void *val, size if(sizeof(codecs) <= *len) { memcpy(val, codecs, sizeof(codecs)); } else { - return FALSE; + return false; } *len = sizeof(codecs); break; case DISPLAY_PROPERTY_RGB_SHIFT: if(sizeof(rgb_shift) > *len) { - return FALSE; + return false; } memcpy(val, rgb_shift, sizeof(rgb_shift)); *len = sizeof(rgb_shift); @@ -622,21 +622,21 @@ static auto display_rpi4_get_property(void *state, int property, void *val, size if(sizeof(supported_il_modes) <= *len) { memcpy(val, supported_il_modes, sizeof(supported_il_modes)); } else { - return FALSE; + return false; } *len = sizeof(supported_il_modes); break; default: - return FALSE; + return false; } - return TRUE; + return true; } static void display_rpi4_put_audio_frame(void *, const struct audio_frame *) { } -static int display_rpi4_reconfigure_audio(void *, int, int, int) +static bool display_rpi4_reconfigure_audio(void *, int, int, int) { return false; } diff --git a/src/video_display/sage.cpp b/src/video_display/sage.cpp index 26455792a3..2e63294d0e 100644 --- a/src/video_display/sage.cpp +++ b/src/video_display/sage.cpp @@ -444,7 +444,7 @@ static sail *initSage(const char *confName, const char *fsIP, int appID, int nod return sageInf; } -static int display_sage_reconfigure(void *state, struct video_desc desc) +static bool display_sage_reconfigure(void *state, struct video_desc desc) { struct state_sage *s = (struct state_sage *)state; @@ -485,10 +485,10 @@ static int display_sage_reconfigure(void *state, struct video_desc desc) s->tile->data = (char *) s->sage_state->getBuffer(); s->tile->data_len = vc_get_linesize(s->tile->width, desc.color_spec) * s->tile->height; - return TRUE; + return true; } -static int display_sage_get_property(void *state, int property, void *val, size_t *len) +static bool display_sage_get_property(void *state, int property, void *val, size_t *len) { struct state_sage *s = (struct state_sage *)state; UNUSED(state); @@ -506,20 +506,20 @@ static int display_sage_get_property(void *state, int property, void *val, size_ memcpy(val, &s->requestedDisplayCodec, sizeof(codec_t)); *len = sizeof(codec_t); } else { - return FALSE; + return false; } } else { if(sizeof(codecs) <= *len) { memcpy(val, codecs, sizeof(codecs)); *len = sizeof(codecs); } else { - return FALSE; + return false; } } break; case DISPLAY_PROPERTY_RGB_SHIFT: if(sizeof(rgb_shift) > *len) { - return FALSE; + return false; } memcpy(val, rgb_shift, sizeof(rgb_shift)); *len = sizeof(rgb_shift); @@ -529,9 +529,9 @@ static int display_sage_get_property(void *state, int property, void *val, size_ *len = sizeof(int); break; default: - return FALSE; + return false; } - return TRUE; + return true; } static void display_sage_put_audio_frame(void *state, const struct audio_frame *frame) @@ -540,7 +540,7 @@ static void display_sage_put_audio_frame(void *state, const struct audio_frame * UNUSED(frame); } -static int display_sage_reconfigure_audio(void *state, int quant_samples, int channels, +static bool display_sage_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { UNUSED(state); @@ -548,7 +548,7 @@ static int display_sage_reconfigure_audio(void *state, int quant_samples, int ch UNUSED(channels); UNUSED(sample_rate); - return FALSE; + return false; } static void display_sage_probe(struct device_info **available_cards, int *count, void (**deleter)(void *)) { diff --git a/src/video_display/sdl.cpp b/src/video_display/sdl.cpp index bab3b8ce52..f68b077e68 100644 --- a/src/video_display/sdl.cpp +++ b/src/video_display/sdl.cpp @@ -140,8 +140,8 @@ struct state_sdl { static void loadSplashscreen(struct state_sdl *s); static void show_help(void); static bool display_sdl_putf(void *state, struct video_frame *frame, long long nonblock); -static int display_sdl_reconfigure(void *state, struct video_desc desc); -static int display_sdl_reconfigure_real(void *state, struct video_desc desc); +static bool display_sdl_reconfigure(void *state, struct video_desc desc); +static bool display_sdl_reconfigure_real(void *state, struct video_desc desc); static void cleanup_screen(struct state_sdl *s); static void configure_audio(struct state_sdl *s); @@ -392,15 +392,15 @@ static void cleanup_screen(struct state_sdl *s) } } -static int display_sdl_reconfigure(void *state, struct video_desc desc) +static bool display_sdl_reconfigure(void *state, struct video_desc desc) { struct state_sdl *s = (struct state_sdl *)state; s->current_desc = desc; - return 1; + return true; } -static int display_sdl_reconfigure_real(void *state, struct video_desc desc) +static bool display_sdl_reconfigure_real(void *state, struct video_desc desc) { struct state_sdl *s = (struct state_sdl *)state; @@ -416,7 +416,7 @@ static int display_sdl_reconfigure_real(void *state, struct video_desc desc) !s->sdl_screen /* first run */) { if (!update_size(s, desc.width, desc.height)) { memset(&s->current_display_desc, 0, sizeof s->current_display_desc); - return FALSE; + return false; } } else { SDL_FillRect(s->sdl_screen, NULL, 0x000000); @@ -440,11 +440,11 @@ static int display_sdl_reconfigure_real(void *state, struct video_desc desc) if (s->yuv_image == NULL) { printf("SDL_overlay initialization failed.\n"); memset(&s->current_display_desc, 0, sizeof s->current_display_desc); - return FALSE; + return false; } } - return TRUE; + return true; } static void *display_sdl_init(struct module *parent, const char *fmt, unsigned int flags) @@ -631,7 +631,7 @@ static bool display_sdl_putf(void *state, struct video_frame *frame, long long n return true; } -static int display_sdl_get_property(void *state, int property, void *val, size_t *len) +static bool display_sdl_get_property(void *state, int property, void *val, size_t *len) { UNUSED(state); codec_t codecs[] = {UYVY, YUYV, RGBA, RGB}; @@ -641,15 +641,15 @@ static int display_sdl_get_property(void *state, int property, void *val, size_t if(sizeof(codecs) <= *len) { memcpy(val, codecs, sizeof(codecs)); } else { - return FALSE; + return false; } *len = sizeof(codecs); break; default: - return FALSE; + return false; } - return TRUE; + return true; } static void sdl_audio_callback(void *userdata, Uint8 *stream, int len) { @@ -676,11 +676,11 @@ static void configure_audio(struct state_sdl *s) s->audio_buffer = ring_buffer_init(1<<20); } -static int display_sdl_reconfigure_audio(void *state, int quant_samples, int channels, +static bool display_sdl_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { struct state_sdl *s = (struct state_sdl *)state; if (!s->play_audio) { - return FALSE; + return false; } SDL_AudioSpec desired, obtained; int sample_type; @@ -712,7 +712,7 @@ static int display_sdl_reconfigure_audio(void *state, int quant_samples, int cha sample_type = AUDIO_S32; break; */ default: - return FALSE; + return false; } desired.freq=sample_rate; @@ -740,12 +740,12 @@ static int display_sdl_reconfigure_audio(void *state, int quant_samples, int cha /* Start playing */ SDL_PauseAudio(0); - return TRUE; + return true; error: s->play_audio = FALSE; s->audio_frame.max_size = 0; s->audio_frame.data = NULL; - return FALSE; + return false; } static void display_sdl_put_audio_frame(void *state, const struct audio_frame *frame) { diff --git a/src/video_display/sdl2.c b/src/video_display/sdl2.c index 4a18bdc142..61353b69fc 100644 --- a/src/video_display/sdl2.c +++ b/src/video_display/sdl2.c @@ -83,7 +83,6 @@ static void show_help(void); static void display_frame(struct state_sdl2 *s, struct video_frame *frame); static struct video_frame *display_sdl2_getf(void *state); static void display_sdl2_new_message(struct module *mod); -static int display_sdl2_reconfigure(void *state, struct video_desc desc); static int display_sdl2_reconfigure_real(void *state, struct video_desc desc); static void loadSplashscreen(struct state_sdl2 *s); @@ -374,7 +373,7 @@ static void show_help(void) SDL_Quit(); } -static int display_sdl2_reconfigure(void *state, struct video_desc desc) +static bool display_sdl2_reconfigure(void *state, struct video_desc desc) { struct state_sdl2 *s = (struct state_sdl2 *) state; @@ -791,7 +790,7 @@ static bool display_sdl2_putf(void *state, struct video_frame *frame, long long return true; } -static int display_sdl2_get_property(void *state, int property, void *val, size_t *len) +static bool display_sdl2_get_property(void *state, int property, void *val, size_t *len) { struct state_sdl2 *s = (struct state_sdl2 *) state; codec_t codecs[VIDEO_CODEC_COUNT]; @@ -803,7 +802,7 @@ static int display_sdl2_get_property(void *state, int property, void *val, size_ memcpy(val, codecs, codecs_len); *len = codecs_len; } else { - return FALSE; + return false; } break; case DISPLAY_PROPERTY_BUF_PITCH: @@ -811,9 +810,9 @@ static int display_sdl2_get_property(void *state, int property, void *val, size_ *len = sizeof(int); break; default: - return FALSE; + return false; } - return TRUE; + return true; } static void display_sdl2_new_message(struct module *mod) diff --git a/src/video_display/unix_sock.cpp b/src/video_display/unix_sock.cpp index 58ae1f640a..fd96926c12 100644 --- a/src/video_display/unix_sock.cpp +++ b/src/video_display/unix_sock.cpp @@ -3,7 +3,7 @@ * @author Martin Piatka */ /* - * Copyright (c) 2022 CESNET, z. s. p. o. + * Copyright (c) 2022-2023 CESNET, z. s. p. o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -271,7 +271,7 @@ static bool display_unix_sock_putf(void *state, struct video_frame *frame, long return true; } -static int display_unix_sock_get_property(void *state, int property, void *val, size_t *len) +static bool display_unix_sock_get_property(void *state, int property, void *val, size_t *len) { UNUSED(state); codec_t codecs[] = {UYVY, RGBA, RGB}; @@ -283,14 +283,14 @@ static int display_unix_sock_get_property(void *state, int property, void *val, if(sizeof(codecs) <= *len) { memcpy(val, codecs, sizeof(codecs)); } else { - return FALSE; + return false; } *len = sizeof(codecs); break; case DISPLAY_PROPERTY_RGB_SHIFT: if(sizeof(rgb_shift) > *len) { - return FALSE; + return false; } memcpy(val, rgb_shift, sizeof(rgb_shift)); *len = sizeof(rgb_shift); @@ -303,23 +303,23 @@ static int display_unix_sock_get_property(void *state, int property, void *val, if(sizeof(supported_il_modes) <= *len) { memcpy(val, supported_il_modes, sizeof(supported_il_modes)); } else { - return FALSE; + return false; } *len = sizeof(supported_il_modes); break; default: - return FALSE; + return false; } - return TRUE; + return true; } -static int display_unix_sock_reconfigure(void *state, struct video_desc desc) +static bool display_unix_sock_reconfigure(void *state, struct video_desc desc) { auto s = static_cast(state); s->desc = desc; - return 1; + return true; } static void display_unix_sock_put_audio_frame(void *state, const struct audio_frame *frame) @@ -328,7 +328,7 @@ static void display_unix_sock_put_audio_frame(void *state, const struct audio_fr UNUSED(frame); } -static int display_unix_sock_reconfigure_audio(void *state, int quant_samples, int channels, +static bool display_unix_sock_reconfigure_audio(void *state, int quant_samples, int channels, int sample_rate) { UNUSED(state); @@ -336,7 +336,7 @@ static int display_unix_sock_reconfigure_audio(void *state, int quant_samples, i UNUSED(channels); UNUSED(sample_rate); - return FALSE; + return false; } static void display_unix_sock_probe(struct device_info **available_cards, int *count, void (**deleter)(void *)) { diff --git a/src/video_display/v4l2.c b/src/video_display/v4l2.c index 6c6cdaa4b0..776651f3f5 100644 --- a/src/video_display/v4l2.c +++ b/src/video_display/v4l2.c @@ -3,7 +3,7 @@ * @author Martin Pulec */ /* - * Copyright (c) 2022 CESNET z.s.p.o. + * Copyright (c) 2022-2023 CESNET z.s.p.o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -236,7 +236,7 @@ static bool display_v4l2_putf(void *state, struct video_frame *frame, long long return true; } -static int display_v4l2_get_property(void *state, int property, void *val, size_t *len) +static bool display_v4l2_get_property(void *state, int property, void *val, size_t *len) { UNUSED(state); enum interlacing_t supported_il_modes[sizeof v4l2_field_map / sizeof v4l2_field_map[0]]; @@ -251,28 +251,28 @@ static int display_v4l2_get_property(void *state, int property, void *val, size_ switch (property) { case DISPLAY_PROPERTY_CODECS: if (sizeof codecs > *len) { - return FALSE; + return false; } memcpy(val, codecs, sizeof codecs); *len = sizeof codecs; break; case DISPLAY_PROPERTY_SUPPORTED_IL_MODES: if (sizeof(supported_il_modes) > *len) { - return FALSE; + return false; } memcpy(val, supported_il_modes, sizeof(supported_il_modes)); *len = sizeof(supported_il_modes); break; default: - return FALSE; + return false; } - return TRUE; + return true; } -static int display_v4l2_reconfigure(void *state, struct video_desc desc) +static bool display_v4l2_reconfigure(void *state, struct video_desc desc) { -#define CHECK(cmd) if (cmd != 0) { log_perror(LOG_LEVEL_ERROR, #cmd); return FALSE; } +#define CHECK(cmd) if (cmd != 0) { log_perror(LOG_LEVEL_ERROR, #cmd); return false; } struct display_v4l2_state *s = state; deinit_device(s); @@ -307,19 +307,19 @@ static int display_v4l2_reconfigure(void *state, struct video_desc desc) reqbuf.memory = V4L2_MEMORY_MMAP; reqbuf.count = BUFFERS; if (!set_v4l2_buffers(s->fd, &reqbuf, s->buffers)) { - return FALSE; + return false; } if (ioctl(s->fd, VIDIOC_STREAMON, &reqbuf.type) != 0) { log_perror(LOG_LEVEL_ERROR, MOD_NAME "Unable to start stream"); - return FALSE; + return false; }; s->f = vf_alloc_desc(desc); s->stream_started = 1; - return TRUE; + return true; #undef CHECK } diff --git a/src/vo_postprocess.c b/src/vo_postprocess.c index 48cf59d208..0df8a23865 100644 --- a/src/vo_postprocess.c +++ b/src/vo_postprocess.c @@ -143,11 +143,12 @@ struct vo_postprocess_state *vo_postprocess_init(const char *config_string) return s; } -int vo_postprocess_reconfigure(struct vo_postprocess_state *s, - struct video_desc desc) +bool +vo_postprocess_reconfigure(struct vo_postprocess_state *s, + struct video_desc desc) { if (s == NULL) { - return FALSE; + return false; } bool filter_complex = false; @@ -157,7 +158,7 @@ int vo_postprocess_reconfigure(struct vo_postprocess_state *s, int ret = state->funcs->reconfigure(state->state, desc); if (ret == FALSE) { simple_linked_list_it_destroy(it); - return FALSE; + return false; } // get desc for next iteration int display_mode = 0; @@ -173,10 +174,10 @@ int vo_postprocess_reconfigure(struct vo_postprocess_state *s, if (filter_complex && simple_linked_list_size(s->postprocessors) > 1) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "One of postprocessors is complex (changing properties) and " "cannot be used in filter chain (more postprocessors)!\n"); - return FALSE; + return false; } - return TRUE; + return true; } struct video_frame * vo_postprocess_getf(struct vo_postprocess_state *s) diff --git a/src/vo_postprocess.h b/src/vo_postprocess.h index 3452a924f5..b3dfbab3d4 100644 --- a/src/vo_postprocess.h +++ b/src/vo_postprocess.h @@ -42,13 +42,15 @@ #ifdef __cplusplus extern "C" { +#else +#include #endif /* property type default */ #define VO_PP_PROPERTY_CODECS 0 /* codec_t[] all uncompressed */ #define VO_PP_DOES_CHANGE_TILING_MODE 1 /* bool false */ -#define VO_PP_ABI_VERSION 6 +#define VO_PP_ABI_VERSION 7 struct vo_postprocess_state; @@ -63,10 +65,8 @@ typedef void *(*vo_postprocess_init_t)(const char *cfg); * * @param state postprocessor state * @param desc video description to be configured to - * - * @return true or false */ -typedef int (*vo_postprocess_reconfigure_t)(void *state, struct video_desc desc); +typedef bool (*vo_postprocess_reconfigure_t)(void *state, struct video_desc desc); typedef struct video_frame * (*vo_postprocess_getf_t)(void *state); /* * Returns various information about postprocessor format not only output (legacy name). @@ -127,7 +127,7 @@ struct vo_postprocess_info { struct vo_postprocess_state *vo_postprocess_init(const char *config_string); -int vo_postprocess_reconfigure(struct vo_postprocess_state *, struct video_desc); +bool vo_postprocess_reconfigure(struct vo_postprocess_state *, struct video_desc); struct video_frame * vo_postprocess_getf(struct vo_postprocess_state *); void vo_postprocess_get_out_desc(struct vo_postprocess_state *, struct video_desc *out, int *display_mode, int *out_frames_count); bool vo_postprocess_get_property(struct vo_postprocess_state *, int property, void *val, size_t *len); diff --git a/src/vo_postprocess/3d-interlaced.c b/src/vo_postprocess/3d-interlaced.c index c1b37d3b4c..7c1ec6fd5c 100644 --- a/src/vo_postprocess/3d-interlaced.c +++ b/src/vo_postprocess/3d-interlaced.c @@ -83,7 +83,8 @@ static void * interlaced_3d_init(const char *config) { #endif } -static int interlaced_3d_postprocess_reconfigure(void *state, struct video_desc desc) +static bool +interlaced_3d_postprocess_reconfigure(void *state, struct video_desc desc) { struct state_interlaced_3d *s = (struct state_interlaced_3d *) state; @@ -103,7 +104,7 @@ static int interlaced_3d_postprocess_reconfigure(void *state, struct video_desc vf_get_tile(s->in, 0)->data = malloc(vf_get_tile(s->in, 0)->data_len); vf_get_tile(s->in, 1)->data = malloc(vf_get_tile(s->in, 1)->data_len); - return TRUE; + return true; } static struct video_frame * interlaced_3d_getf(void *state) diff --git a/src/vo_postprocess/border.c b/src/vo_postprocess/border.c index 0b9b2fd09a..083d6dae25 100644 --- a/src/vo_postprocess/border.c +++ b/src/vo_postprocess/border.c @@ -123,13 +123,14 @@ static void * border_init(const char *config) { return s; } -static int border_postprocess_reconfigure(void *state, struct video_desc desc) +static bool +border_postprocess_reconfigure(void *state, struct video_desc desc) { struct state_border *s = (struct state_border *) state; s->saved_desc = desc; vf_free(s->in); s->in = vf_alloc_desc_data(s->saved_desc); - return TRUE; + return true; } static struct video_frame * border_getf(void *state) diff --git a/src/vo_postprocess/capture_filter_wrapper.h b/src/vo_postprocess/capture_filter_wrapper.h index a7743f37cf..3758348811 100644 --- a/src/vo_postprocess/capture_filter_wrapper.h +++ b/src/vo_postprocess/capture_filter_wrapper.h @@ -68,10 +68,10 @@ static void *CF_WRAPPER_MERGE(vo_pp_init_, name)(const char *cfg) {\ return s;\ }\ \ -static int CF_WRAPPER_MERGE(vo_pp_reconfigure_, name)(void *state, struct video_desc desc) {\ +static bool CF_WRAPPER_MERGE(vo_pp_reconfigure_, name)(void *state, struct video_desc desc) {\ struct vo_pp_capture_filter_wrapper *s = (struct vo_pp_capture_filter_wrapper *) state;\ s->f = vf_alloc_desc_data(desc);\ - return TRUE;\ + return true;\ }\ \ static bool CF_WRAPPER_MERGE(vo_pp_get_property_, name)(void *state, int property, void *val, size_t *len) {\ diff --git a/src/vo_postprocess/crop.c b/src/vo_postprocess/crop.c index b152c3ece0..7fdb5340b2 100644 --- a/src/vo_postprocess/crop.c +++ b/src/vo_postprocess/crop.c @@ -120,7 +120,8 @@ static void * crop_init(const char *config) { return s; } -static int crop_postprocess_reconfigure(void *state, struct video_desc desc) +static bool +crop_postprocess_reconfigure(void *state, struct video_desc desc) { struct state_crop *s = state; vf_free(s->in); @@ -138,7 +139,7 @@ static int crop_postprocess_reconfigure(void *state, struct video_desc desc) * get_pf_block_bytes(desc.color_spec); s->out_desc.width = linesize / get_bpp(desc.color_spec); - return TRUE; + return true; } static struct video_frame * crop_getf(void *state) diff --git a/src/vo_postprocess/deinterlace.c b/src/vo_postprocess/deinterlace.c index d96a1a69c9..b304dee993 100644 --- a/src/vo_postprocess/deinterlace.c +++ b/src/vo_postprocess/deinterlace.c @@ -131,7 +131,8 @@ static bool deinterlace_get_property(void *state, int property, void *val, size_ return false; } -static int deinterlace_reconfigure(void *state, struct video_desc desc) +static bool +deinterlace_reconfigure(void *state, struct video_desc desc) { struct state_deinterlace *s = (struct state_deinterlace *) state; @@ -139,7 +140,7 @@ static int deinterlace_reconfigure(void *state, struct video_desc desc) assert(desc.tile_count == 1); s->out = vf_alloc_desc_data(desc); - return TRUE; + return true; } static struct video_frame * deinterlace_getf(void *state) diff --git a/src/vo_postprocess/interlace.c b/src/vo_postprocess/interlace.c index cfd78ed247..7ff7c82be4 100644 --- a/src/vo_postprocess/interlace.c +++ b/src/vo_postprocess/interlace.c @@ -93,7 +93,8 @@ static bool interlace_get_property(void *state, int property, void *val, size_t return false; } -static int interlace_reconfigure(void *state, struct video_desc desc) +static bool +interlace_reconfigure(void *state, struct video_desc desc) { struct state_interlace *s = (struct state_interlace *) state; @@ -104,7 +105,7 @@ static int interlace_reconfigure(void *state, struct video_desc desc) s->last = EVEN; - return TRUE; + return true; } static struct video_frame * interlace_getf(void *state) diff --git a/src/vo_postprocess/scale.c b/src/vo_postprocess/scale.c index ac7ccc97ea..f44b2afdf7 100644 --- a/src/vo_postprocess/scale.c +++ b/src/vo_postprocess/scale.c @@ -150,7 +150,8 @@ static void * scale_init(const char *config) { return s; } -static int scale_reconfigure(void *state, struct video_desc desc) +static bool +scale_reconfigure(void *state, struct video_desc desc) { struct state_scale *s = (struct state_scale *) state; struct tile *in_tile; @@ -216,7 +217,7 @@ static int scale_reconfigure(void *state, struct video_desc desc) 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - return TRUE; + return true; } static struct video_frame * scale_getf(void *state) diff --git a/src/vo_postprocess/split.c b/src/vo_postprocess/split.c index 2882d41657..2859f958a7 100644 --- a/src/vo_postprocess/split.c +++ b/src/vo_postprocess/split.c @@ -117,7 +117,8 @@ static void * split_init(const char *config) { return s; } -static int split_postprocess_reconfigure(void *state, struct video_desc desc) +static bool +split_postprocess_reconfigure(void *state, struct video_desc desc) { struct state_split *s = (struct state_split *) state; struct tile *in_tile = vf_get_tile(s->in, 0); @@ -133,7 +134,7 @@ static int split_postprocess_reconfigure(void *state, struct video_desc desc) desc.height; in_tile->data = malloc(in_tile->data_len); - return TRUE; + return true; } static struct video_frame * split_getf(void *state) diff --git a/src/vo_postprocess/temporal-deint.c b/src/vo_postprocess/temporal-deint.c index 0f9743010e..210acc88aa 100644 --- a/src/vo_postprocess/temporal-deint.c +++ b/src/vo_postprocess/temporal-deint.c @@ -170,7 +170,8 @@ static bool common_get_property(void *state, int property, void *val, size_t *le return false; } -static int common_postprocess_reconfigure(void *state, struct video_desc desc) +static bool +common_postprocess_reconfigure(void *state, struct video_desc desc) { struct state_df *s = (struct state_df *) state; struct tile *in_tile = vf_get_tile(s->in, 0); @@ -197,7 +198,7 @@ static int common_postprocess_reconfigure(void *state, struct video_desc desc) s->buffers[1] = (char *) malloc(in_tile->data_len); in_tile->data = s->buffers[s->buffer_current]; - return TRUE; + return true; } static struct video_frame * common_getf(void *state) diff --git a/src/vo_postprocess/text.c b/src/vo_postprocess/text.c index 2de0286fde..35b92a5992 100644 --- a/src/vo_postprocess/text.c +++ b/src/vo_postprocess/text.c @@ -164,7 +164,8 @@ static int cf_text_init(struct module *parent, const char *cfg, void **state) } } -static int text_postprocess_reconfigure(void *state, struct video_desc desc) +static bool +text_postprocess_reconfigure(void *state, struct video_desc desc) { struct state_text *s = (struct state_text *) state; @@ -203,7 +204,7 @@ static int text_postprocess_reconfigure(void *state, struct video_desc desc) } else { log_msg(LOG_LEVEL_ERROR, "[text vo_pp.] Codec not supported! Please report to " PACKAGE_BUGREPORT ".\n"); - return FALSE; + return false; } s->dw = NewDrawingWand(); @@ -211,7 +212,7 @@ static int text_postprocess_reconfigure(void *state, struct video_desc desc) MagickBooleanType status = DrawSetFont(s->dw, "helvetica"); if(status != MagickTrue) { log_msg(LOG_LEVEL_WARNING, "[text vo_pp.] DraweSetFont failed!\n"); - return FALSE; + return false; } { PixelWand *pw = NewPixelWand(); @@ -226,22 +227,22 @@ static int text_postprocess_reconfigure(void *state, struct video_desc desc) status = MagickSetFormat(s->wand, colorspace); if(status != MagickTrue) { log_msg(LOG_LEVEL_WARNING, "[text vo_pp.] MagickSetFormat failed!\n"); - return FALSE; + return false; } status = MagickSetSize(s->wand, s->width, s->height); if(status != MagickTrue) { log_msg(LOG_LEVEL_WARNING, "[text vo_pp.] MagickSetSize failed!\n"); - return FALSE; + return false; } status = MagickSetDepth(s->wand, 8); if(status != MagickTrue) { log_msg(LOG_LEVEL_WARNING, "[text vo_pp.] MagickSetDepth failed!\n"); - return FALSE; + return false; } - return TRUE; + return true; } static struct video_frame * text_getf(void *state)