aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dabInput.h2
-rw-r--r--src/input/File.cpp18
-rw-r--r--src/input/File.h6
-rw-r--r--src/input/Prbs.cpp8
-rw-r--r--src/input/Prbs.h2
-rw-r--r--src/input/Udp.cpp2
-rw-r--r--src/input/Udp.h2
-rw-r--r--src/input/Zmq.cpp2
-rw-r--r--src/input/Zmq.h2
-rw-r--r--src/input/inputs.h2
10 files changed, 21 insertions, 25 deletions
diff --git a/src/dabInput.h b/src/dabInput.h
index 0accddb..d2c5f49 100644
--- a/src/dabInput.h
+++ b/src/dabInput.h
@@ -62,7 +62,7 @@ class DabInputCompatible : public DabInputBase {
virtual int setbuf(int size)
{ return m_ops.setbuf(args, size); }
- virtual int readFrame(void* buffer, int size)
+ virtual int readFrame(uint8_t* buffer, size_t size)
{
if (m_ops.lock) {
m_ops.lock(args);
diff --git a/src/input/File.cpp b/src/input/File.cpp
index 9721b97..eb26136 100644
--- a/src/input/File.cpp
+++ b/src/input/File.cpp
@@ -64,7 +64,7 @@ int FileBase::rewind()
return ::lseek(m_fd, 0, SEEK_SET);
}
-int MPEGFile::readFrame(void* buffer, int size)
+int MPEGFile::readFrame(uint8_t* buffer, size_t size)
{
int result;
bool do_rewind = false;
@@ -122,7 +122,7 @@ MUTE_SUBCHANNEL:
memset(buffer, 0, size);
}
else {
- if (result < size) {
+ if (result < (ssize_t)size) {
etiLog.log(warn, "bitrate too low from file "
"-> frame padded\n");
memset((char*)buffer + result, 0, size - result);
@@ -164,7 +164,7 @@ MUTE_SUBCHANNEL:
int MPEGFile::setBitrate(int bitrate)
{
if (bitrate == 0) {
- char buffer[4];
+ uint8_t buffer[4];
if (readFrame(buffer, 4) == 0) {
bitrate = getMpegBitrate(buffer);
@@ -178,11 +178,9 @@ int MPEGFile::setBitrate(int bitrate)
}
-int DABPlusFile::readFrame(void* buffer, int size)
+int DABPlusFile::readFrame(uint8_t* buffer, size_t size)
{
- uint8_t* dataOut = reinterpret_cast<uint8_t*>(buffer);
-
- ssize_t ret = read(m_fd, dataOut, size);
+ ssize_t ret = read(m_fd, buffer, size);
if (ret == -1) {
etiLog.log(alert, "ERROR: Can't read file\n");
@@ -190,7 +188,7 @@ int DABPlusFile::readFrame(void* buffer, int size)
return -1;
}
- if (ret < size) {
+ if (ret < (ssize_t)size) {
ssize_t sizeOut = ret;
etiLog.log(info, "reach end of file -> rewinding\n");
if (rewind() == -1) {
@@ -198,14 +196,14 @@ int DABPlusFile::readFrame(void* buffer, int size)
return -1;
}
- ret = read(m_fd, dataOut + sizeOut, size - sizeOut);
+ ret = read(m_fd, buffer + sizeOut, size - sizeOut);
if (ret == -1) {
etiLog.log(alert, "ERROR: Can't read file\n");
perror("");
return -1;
}
- if (ret < size) {
+ if (ret < (ssize_t)size) {
etiLog.log(alert, "ERROR: Not enough data in file\n");
return -1;
}
diff --git a/src/input/File.h b/src/input/File.h
index 61be8b1..01f4f21 100644
--- a/src/input/File.h
+++ b/src/input/File.h
@@ -36,7 +36,7 @@ namespace Inputs {
class FileBase : public InputBase {
public:
virtual int open(const std::string& name);
- virtual int readFrame(void* buffer, int size) = 0;
+ virtual int readFrame(uint8_t* buffer, size_t size) = 0;
virtual int setBitrate(int bitrate) = 0;
virtual int close();
@@ -52,7 +52,7 @@ class FileBase : public InputBase {
class MPEGFile : public FileBase {
public:
- virtual int readFrame(void* buffer, int size);
+ virtual int readFrame(uint8_t* buffer, size_t size);
virtual int setBitrate(int bitrate);
private:
@@ -61,7 +61,7 @@ class MPEGFile : public FileBase {
class DABPlusFile : public FileBase {
public:
- virtual int readFrame(void* buffer, int size);
+ virtual int readFrame(uint8_t* buffer, size_t size);
virtual int setBitrate(int bitrate);
};
diff --git a/src/input/Prbs.cpp b/src/input/Prbs.cpp
index 8e5a9ae..607ce9f 100644
--- a/src/input/Prbs.cpp
+++ b/src/input/Prbs.cpp
@@ -77,12 +77,10 @@ int Prbs::open(const string& name)
return 0;
}
-int Prbs::readFrame(void* buffer, int size)
+int Prbs::readFrame(uint8_t* buffer, size_t size)
{
- unsigned char* cbuffer = reinterpret_cast<unsigned char*>(buffer);
-
- for (int i = 0; i < size; ++i) {
- cbuffer[i] = m_prbs.step();
+ for (size_t i = 0; i < size; ++i) {
+ buffer[i] = m_prbs.step();
}
return size;
diff --git a/src/input/Prbs.h b/src/input/Prbs.h
index 1ad5047..3b2b7d4 100644
--- a/src/input/Prbs.h
+++ b/src/input/Prbs.h
@@ -38,7 +38,7 @@ namespace Inputs {
class Prbs : public InputBase {
public:
virtual int open(const std::string& name);
- virtual int readFrame(void* buffer, int size);
+ virtual int readFrame(uint8_t* buffer, size_t size);
virtual int setBitrate(int bitrate);
virtual int close();
diff --git a/src/input/Udp.cpp b/src/input/Udp.cpp
index e534a06..a238d9b 100644
--- a/src/input/Udp.cpp
+++ b/src/input/Udp.cpp
@@ -87,7 +87,7 @@ int Udp::open(const std::string& name)
return 0;
}
-int Udp::readFrame(void* buffer, int size)
+int Udp::readFrame(uint8_t* buffer, size_t size)
{
uint8_t* data = reinterpret_cast<uint8_t*>(buffer);
diff --git a/src/input/Udp.h b/src/input/Udp.h
index b6705e9..379dbf3 100644
--- a/src/input/Udp.h
+++ b/src/input/Udp.h
@@ -36,7 +36,7 @@ namespace Inputs {
class Udp : public InputBase {
public:
virtual int open(const std::string& name);
- virtual int readFrame(void* buffer, int size);
+ virtual int readFrame(uint8_t* buffer, size_t size);
virtual int setBitrate(int bitrate);
virtual int close();
diff --git a/src/input/Zmq.cpp b/src/input/Zmq.cpp
index 985fad3..a5601fa 100644
--- a/src/input/Zmq.cpp
+++ b/src/input/Zmq.cpp
@@ -246,7 +246,7 @@ int ZmqBase::setBitrate(int bitrate)
}
// size corresponds to a frame size. It is constant for a given bitrate
-int ZmqBase::readFrame(void* buffer, int size)
+int ZmqBase::readFrame(uint8_t* buffer, size_t size)
{
int rc;
diff --git a/src/input/Zmq.h b/src/input/Zmq.h
index 02fce3a..8d729e0 100644
--- a/src/input/Zmq.h
+++ b/src/input/Zmq.h
@@ -181,7 +181,7 @@ class ZmqBase : public InputBase, public RemoteControllable {
}
virtual int open(const std::string& inputUri);
- virtual int readFrame(void* buffer, int size);
+ virtual int readFrame(uint8_t* buffer, size_t size);
virtual int setBitrate(int bitrate);
virtual int close();
diff --git a/src/input/inputs.h b/src/input/inputs.h
index 3bc1fa4..bfb1fb6 100644
--- a/src/input/inputs.h
+++ b/src/input/inputs.h
@@ -39,7 +39,7 @@ namespace Inputs {
class InputBase {
public:
virtual int open(const std::string& name) = 0;
- virtual int readFrame(void* buffer, int size) = 0;
+ virtual int readFrame(uint8_t* buffer, size_t size) = 0;
virtual int setBitrate(int bitrate) = 0;
virtual int close() = 0;