summaryrefslogtreecommitdiffstats
path: root/src/dabInputZmq.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2014-02-11 13:48:04 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2014-02-11 13:48:04 +0100
commitc2237319d9c8267b08ad78e92fde5615e7b3041d (patch)
tree9e2c1ed8ee5a119a989cc7e2405083c11593801a /src/dabInputZmq.h
parent7c0ba33167476500b0593598814b95304a3d4ded (diff)
downloaddabmux-c2237319d9c8267b08ad78e92fde5615e7b3041d.tar.gz
dabmux-c2237319d9c8267b08ad78e92fde5615e7b3041d.tar.bz2
dabmux-c2237319d9c8267b08ad78e92fde5615e7b3041d.zip
inputZMQ readframe can be common to MPEG and AAC+
Diffstat (limited to 'src/dabInputZmq.h')
-rw-r--r--src/dabInputZmq.h34
1 files changed, 25 insertions, 9 deletions
diff --git a/src/dabInputZmq.h b/src/dabInputZmq.h
index 97dd911..e3d6153 100644
--- a/src/dabInputZmq.h
+++ b/src/dabInputZmq.h
@@ -7,6 +7,10 @@
ZeroMQ input. see www.zeromq.org for more info
+ For the AAC+ input, each zeromq message must contain one superframe.
+
+ For the MPEG input, each zeromq message must contain one frame.
+
From the ZeroMQ manpage 'zmq':
The 0MQ lightweight messaging kernel is a library which extends the standard
@@ -66,10 +70,11 @@ class DabInputZmqBase : public DabInputBase, public RemoteControllable {
: RemoteControllable(name),
m_name(name), m_zmq_context(1),
m_zmq_sock(m_zmq_context, ZMQ_SUB),
- m_bitrate(0) { }
+ m_bitrate(0), m_prebuffering(INPUT_ZMQ_PREBUFFERING) {
+ }
virtual int open(const std::string inputUri);
- virtual int readFrame(void* buffer, int size) = 0;
+ virtual int readFrame(void* buffer, int size);
virtual int setBitrate(int bitrate);
virtual int close();
@@ -80,27 +85,38 @@ class DabInputZmqBase : public DabInputBase, public RemoteControllable {
virtual string get_parameter(string parameter);
protected:
+ virtual int readFromSocket(int framesize) = 0;
+
std::string m_name;
zmq::context_t m_zmq_context;
zmq::socket_t m_zmq_sock; // handle for the zmq socket
int m_bitrate;
+ int m_prebuffering;
+ std::list<char*> m_frame_buffer; //stores elements of type char[<framesize>]
+};
+
+class DabInputZmqMPEG : public DabInputZmqBase {
+ public:
+ DabInputZmqMPEG(const std::string name)
+ : DabInputZmqBase("MPEG " + name) {
+ RC_ADD_PARAMETER(buffer,
+ "Size of the input buffer [mpeg frames]");
+ }
+
+ private:
+ virtual int readFromSocket(int framesize);
};
class DabInputZmqAAC : public DabInputZmqBase {
public:
DabInputZmqAAC(const std::string name)
- : DabInputZmqBase(name),
- m_prebuffering(INPUT_ZMQ_PREBUFFERING) {
+ : DabInputZmqBase("AAC+ " + name) {
RC_ADD_PARAMETER(buffer,
"Size of the input buffer [aac superframes]");
}
- virtual int readFrame(void* buffer, int size);
private:
- int readFromSocket(int framesize);
-
- int m_prebuffering;
- std::list<char*> m_frame_buffer; //stores elements of type char[<framesize>]
+ virtual int readFromSocket(int framesize);
};
#endif // HAVE_INPUT_ZMQ