build: use ifdef instead of `if for various defines

Change-Id: I386bd1adddf403ff450e5d22688337b7d6d7c1f6
This commit is contained in:
Adrien Béraud
2022-06-22 16:27:06 -04:00
parent ce645d4fd3
commit fa7fb8beb0
8 changed files with 21 additions and 24 deletions

View File

@ -89,7 +89,7 @@ systems. This function is required for `alloca.c' support on those systems.
#define HAVE_PULSE 0
/* Define if you have shared memory support */
#define HAVE_SHM 0
#undef ENABLE_SHM
/* Define if you have libspeex */
#define HAVE_SPEEX 0

View File

@ -620,10 +620,8 @@ AM_CONDITIONAL([BUILD_NATPMP], test "x$with_natpmp" = "xyes")
# SHM
dnl check for shm
AC_DEFINE_UNQUOTED([HAVE_SHM],
`if test "x$with_dbus" == xyes; then echo 1; else echo 0; fi`,
[Define if you have shared memory support])
AS_IF([test "x$with_dbus" == xyes],
AC_DEFINE([ENABLE_SHM], [1], [Define if you have shared memory support]))
# LTTNG
AM_COND_IF([ENABLE_TRACEPOINTS],

View File

@ -156,8 +156,7 @@ else
endif
conf.set10('HAVE_COREAUDIO', host_machine.system() == 'darwin')
conf.set10('HAVE_SHM', get_option('interfaces').contains('dbus'))
conf.set('ENABLE_SHM', get_option('interfaces').contains('dbus'))
configure_file(
output: 'config.h',
configuration: conf

View File

@ -535,7 +535,7 @@ registerSinkTarget(const std::string& sinkId, SinkTarget target)
return false;
}
#if HAVE_SHM
#ifdef ENABLE_SHM
void
startShmSink(const std::string& sinkId, bool value)
{

View File

@ -29,7 +29,7 @@
#include <map>
#include <list>
#if __APPLE__
#ifdef __APPLE__
#import "TargetConditionals.h"
#endif

View File

@ -43,7 +43,7 @@ void av_frame_free(AVFrame** frame);
#include <cstdint>
#include <cstdlib>
#if __APPLE__
#ifdef __APPLE__
#import "TargetConditionals.h"
#endif
@ -195,7 +195,7 @@ DRING_PUBLIC bool playerSeekToTime(const std::string& id, int time);
int64_t getPlayerPosition(const std::string& id);
DRING_PUBLIC bool registerSinkTarget(const std::string& sinkId, SinkTarget target);
#if HAVE_SHM
#ifdef ENABLE_SHM
DRING_PUBLIC void startShmSink(const std::string& sinkId, bool value);
#endif
DRING_PUBLIC std::map<std::string, std::string> getRenderer(const std::string& callId);
@ -252,7 +252,7 @@ struct DRING_PUBLIC VideoSignal
const std::string& /*shm_path*/,
bool /*is_mixer*/);
};
#if __ANDROID__
#ifdef __ANDROID__
struct DRING_PUBLIC SetParameters
{
constexpr static const char* name = "SetParameters";

View File

@ -26,9 +26,9 @@
#include "sinkclient.h"
#if HAVE_SHM
#ifdef ENABLE_SHM
#include "shm_header.h"
#endif // HAVE_SHM
#endif // ENABLE_SHM
#include "media_buffer.h"
#include "logger.h"
@ -63,7 +63,7 @@ namespace video {
const constexpr char FILTER_INPUT_NAME[] = "in";
#if HAVE_SHM
#ifdef ENABLE_SHM
// RAII class helper on sem_wait/sem_post sempahore operations
class SemGuardLock
{
@ -300,7 +300,7 @@ SinkClient::stop() noexcept
return true;
}
#else // HAVE_SHM
#else // ENABLE_SHM
std::string
SinkClient::openedName() const noexcept
@ -322,7 +322,7 @@ SinkClient::stop() noexcept
return true;
}
#endif // !HAVE_SHM
#endif // !ENABLE_SHM
SinkClient::SinkClient(const std::string& id, bool mixer)
: id_ {id}
@ -439,7 +439,7 @@ SinkClient::update(Observable<std::shared_ptr<MediaFrame>>* /*obs*/,
}
bool doTransfer = hasTransformedListener or hasObservers;
#if HAVE_SHM
#ifdef ENABLE_SHM
doTransfer |= (shm_ && doShmTransfer_);
#endif
@ -455,7 +455,7 @@ SinkClient::update(Observable<std::shared_ptr<MediaFrame>>* /*obs*/,
setFrameSize(frame->width(), frame->height());
return;
}
#if HAVE_SHM
#ifdef ENABLE_SHM
if (shm_ && doShmTransfer_)
shm_->renderFrame(*frame);
#endif

View File

@ -42,9 +42,9 @@ class MediaFilter;
namespace jami {
namespace video {
#if HAVE_SHM
#ifdef ENABLE_SHM
class ShmHolder;
#endif // HAVE_SHM
#endif // ENABLE_SHM
class VideoScaler;
@ -82,7 +82,7 @@ public:
target_ = std::move(target);
}
#if HAVE_SHM
#ifdef ENABLE_SHM
void enableShm(bool value) { doShmTransfer_.store(value); }
#endif
@ -122,11 +122,11 @@ private:
std::chrono::steady_clock::time_point lastFrameDebug_;
#endif
#if HAVE_SHM
#ifdef ENABLE_SHM
// using shared_ptr and not unique_ptr as ShmHolder is forwared only
std::shared_ptr<ShmHolder> shm_;
std::atomic_bool doShmTransfer_ {false};
#endif // HAVE_SHM
#endif // ENABLE_SHM
};
} // namespace video