aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2019-07-03 15:48:30 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2019-07-03 15:48:30 +0200
commit36219517c52ad97ab96545c9289b82890861d77b (patch)
tree7d1f73ac9c3c0009df86ef4210ecba6f39b90bd8 /src
parente7a9a94fb8ebd50e10ed403ef871620181d3aa1d (diff)
downloadODR-AudioEnc-36219517c52ad97ab96545c9289b82890861d77b.tar.gz
ODR-AudioEnc-36219517c52ad97ab96545c9289b82890861d77b.tar.bz2
ODR-AudioEnc-36219517c52ad97ab96545c9289b82890861d77b.zip
Enable -Wall and fix a few warnings
Diffstat (limited to 'src')
-rw-r--r--src/AACDecoder.cpp2
-rw-r--r--src/AlsaInput.cpp5
-rw-r--r--src/FileInput.cpp2
-rw-r--r--src/JackInput.cpp4
-rw-r--r--src/Outputs.cpp4
-rw-r--r--src/Outputs.h4
-rw-r--r--src/SampleQueue.h2
-rw-r--r--src/VLCInput.cpp2
-rw-r--r--src/odr-audioenc.cpp5
-rw-r--r--src/wavfile.cpp8
10 files changed, 18 insertions, 20 deletions
diff --git a/src/AACDecoder.cpp b/src/AACDecoder.cpp
index 861bdaf..bbbed47 100644
--- a/src/AACDecoder.cpp
+++ b/src/AACDecoder.cpp
@@ -38,7 +38,7 @@ void AACDecoder::decode_frame(uint8_t *data, size_t len)
const bool sbr_flag = data[2] & 0x20;
const bool aac_channel_mode = data[2] & 0x10;
const bool ps_flag = data[2] & 0x08;
- const uint8_t mpeg_surround_config = data[2] & 0x07;
+ //const uint8_t mpeg_surround_config = data[2] & 0x07;
const int core_sr_index = dac_rate ?
(sbr_flag ? 6 : 3) : (sbr_flag ? 8 : 5); // 24/48/16/32 kHz
diff --git a/src/AlsaInput.cpp b/src/AlsaInput.cpp
index 747814f..0d3b40e 100644
--- a/src/AlsaInput.cpp
+++ b/src/AlsaInput.cpp
@@ -106,12 +106,11 @@ void AlsaInput::m_init_alsa()
ssize_t AlsaInput::m_read(uint8_t* buf, snd_pcm_uframes_t length)
{
- int i;
int err;
err = snd_pcm_readi(m_alsa_handle, buf, length);
- if (err != length) {
+ if (err != (ssize_t)length) {
if (err < 0) {
fprintf (stderr, "read from audio interface failed (%s)\n",
snd_strerror(err));
@@ -176,7 +175,7 @@ bool AlsaInputDirect::read_source(size_t num_bytes)
if (ret > 0) {
m_queue.push(buf.data(), ret * bytes_per_frame);
}
- return ret == num_frames;
+ return ret == (ssize_t)num_frames;
}
#endif // HAVE_ALSA
diff --git a/src/FileInput.cpp b/src/FileInput.cpp
index 5eb39ee..51b0456 100644
--- a/src/FileInput.cpp
+++ b/src/FileInput.cpp
@@ -101,7 +101,7 @@ bool FileInput::read_source(size_t num_bytes)
m_queue.push(samplebuf.data(), ret);
}
- if (ret < num_bytes) {
+ if (ret < (ssize_t)num_bytes) {
if (m_raw_input) {
if (ferror(m_in_fh)) {
return false;
diff --git a/src/JackInput.cpp b/src/JackInput.cpp
index 958685d..bc57588 100644
--- a/src/JackInput.cpp
+++ b/src/JackInput.cpp
@@ -80,7 +80,7 @@ void JackInput::prepare()
}
/* create ports */
- for (int i = 0; i < m_channels; i++) {
+ for (unsigned int i = 0; i < m_channels; i++) {
std::stringstream port_name;
port_name << "input" << i;
@@ -118,7 +118,7 @@ void JackInput::jack_process(jack_nframes_t nframes)
*/
std::vector<int16_t> buffer(m_channels * nframes);
- for (int chan = 0; chan < m_channels; chan++) {
+ for (unsigned int chan = 0; chan < m_channels; chan++) {
// start offset interleaving
int i = chan;
diff --git a/src/Outputs.cpp b/src/Outputs.cpp
index 6249e2d..31c7912 100644
--- a/src/Outputs.cpp
+++ b/src/Outputs.cpp
@@ -139,7 +139,7 @@ EDI::EDI() { }
EDI::~EDI() { }
-void EDI::add_udp_destination(const std::string& host, int port)
+void EDI::add_udp_destination(const std::string& host, unsigned int port)
{
auto dest = make_shared<edi::udp_destination_t>();
dest->dest_addr = host;
@@ -152,7 +152,7 @@ void EDI::add_udp_destination(const std::string& host, int port)
// TODO make FEC configurable
}
-void EDI::add_tcp_destination(const std::string& host, int port)
+void EDI::add_tcp_destination(const std::string& host, unsigned int port)
{
auto dest = make_shared<edi::tcp_client_t>();
dest->dest_addr = host;
diff --git a/src/Outputs.h b/src/Outputs.h
index 513def4..b5ee25a 100644
--- a/src/Outputs.h
+++ b/src/Outputs.h
@@ -131,8 +131,8 @@ class EDI: public Base {
EDI& operator=(const EDI&) = delete;
virtual ~EDI() override;
- void add_udp_destination(const std::string& host, int port);
- void add_tcp_destination(const std::string& host, int port);
+ void add_udp_destination(const std::string& host, unsigned int port);
+ void add_tcp_destination(const std::string& host, unsigned int port);
bool enabled() const;
diff --git a/src/SampleQueue.h b/src/SampleQueue.h
index f39dbd7..95706ee 100644
--- a/src/SampleQueue.h
+++ b/src/SampleQueue.h
@@ -67,8 +67,8 @@ public:
unsigned int channels,
size_t max_size,
bool drift_compensation) :
- m_bytes_per_sample(bytes_per_sample),
m_channels(channels),
+ m_bytes_per_sample(bytes_per_sample),
m_max_size(max_size),
m_push_block(not drift_compensation),
m_overruns(0) {}
diff --git a/src/VLCInput.cpp b/src/VLCInput.cpp
index ae7356f..80e85be 100644
--- a/src/VLCInput.cpp
+++ b/src/VLCInput.cpp
@@ -82,7 +82,7 @@ void handleStream_size_t(
{
VLCInput* in = (VLCInput*)p_audio_data;
- assert(rate == in->getRate());
+ assert((ssize_t)rate == in->getRate());
assert(bits_per_sample == 8*bytes_per_float_sample);
// This assumes VLC always gives back the full
diff --git a/src/odr-audioenc.cpp b/src/odr-audioenc.cpp
index 09dceb5..6b82c5f 100644
--- a/src/odr-audioenc.cpp
+++ b/src/odr-audioenc.cpp
@@ -909,7 +909,7 @@ int AudioEnc::run()
/*! pop_wait() must return after a timeout, otherwise the silence detector cannot do
* its job. */
- size_t bytes_from_queue = queue.pop_wait(&input_buf[0], read_bytes, timeout_ms, &overruns); // returns bytes
+ ssize_t bytes_from_queue = queue.pop_wait(&input_buf[0], read_bytes, timeout_ms, &overruns); // returns bytes
if (overruns) {
throw logic_error("Queue overrun in non-drift compensation!");
@@ -1009,7 +1009,6 @@ int AudioEnc::run()
//
int in_identifier[] = {IN_AUDIO_DATA, IN_ANCILLRY_DATA};
int out_identifier = OUT_BITSTREAM_DATA;
- const int subchannel_index = bitrate / 8;
void *in_ptr[2], *out_ptr;
int in_size[2], in_elem_size[2];
@@ -1133,7 +1132,7 @@ int AudioEnc::run()
toolame_buffer.insert(toolame_buffer.end(), outbuf.begin(), outbuf.begin() + numOutBytes);
// ODR-DabMux expects frames of length 3*bitrate
- const auto frame_len = 3 * bitrate;
+ const size_t frame_len = 3 * bitrate;
while (toolame_buffer.size() > frame_len) {
vec_u8 frame(frame_len);
// this is probably not very efficient
diff --git a/src/wavfile.cpp b/src/wavfile.cpp
index 4bd4bd6..fd3dc43 100644
--- a/src/wavfile.cpp
+++ b/src/wavfile.cpp
@@ -226,10 +226,10 @@ void WavWriter::initialise_header(int rate, int channels)
int samples_per_second = rate;
int bits_per_sample = 16;
- strncpy(header.riff_tag,"RIFF",4);
- strncpy(header.wave_tag,"WAVE",4);
- strncpy(header.fmt_tag,"fmt ",4);
- strncpy(header.data_tag,"data",4);
+ memcpy(header.riff_tag,"RIFF",4);
+ memcpy(header.wave_tag,"WAVE",4);
+ memcpy(header.fmt_tag,"fmt ",4);
+ memcpy(header.data_tag,"data",4);
header.riff_length = 0;
header.fmt_length = 16;