|
a/sc2src/rcvqueue.h |
|
b/sc2src/rcvqueue.h |
|
... |
|
... |
71 |
// Note that the module does not derive from this class, it initializes an
|
71 |
// Note that the module does not derive from this class, it initializes an
|
72 |
// object with appropriate values.
|
72 |
// object with appropriate values.
|
73 |
class AudioEater {
|
73 |
class AudioEater {
|
74 |
public:
|
74 |
public:
|
75 |
enum BOrder {BO_MSB, BO_LSB, BO_HOST};
|
75 |
enum BOrder {BO_MSB, BO_LSB, BO_HOST};
|
|
|
76 |
enum AudioState { UNKNOWN, STOPPED, PLAYING };
|
76 |
struct Context {
|
77 |
struct Context {
|
77 |
Context(WorkQueue<AudioMessage*> *q) : queue(q) {}
|
78 |
Context(WorkQueue<AudioMessage*> *q) : queue(q) {}
|
78 |
WorkQueue<AudioMessage*> *queue{nullptr};
|
79 |
WorkQueue<AudioMessage*> *queue{nullptr};
|
79 |
ConfSimple *config{nullptr};
|
80 |
ConfSimple *config{nullptr};
|
80 |
};
|
81 |
};
|
81 |
|
82 |
|
82 |
// Constructor called by downstream module to set its params
|
83 |
// Constructor called by downstream module to set its params
|
83 |
AudioEater(BOrder o, void *(*w)(void *))
|
84 |
AudioEater(BOrder o, void *(*w)(void *), AudioState (*s)() = NULL)
|
84 |
: input_border(o), worker(w) {
|
85 |
: input_border(o), worker(w), state(s) {
|
85 |
}
|
86 |
}
|
86 |
|
87 |
|
87 |
BOrder input_border;
|
88 |
BOrder input_border;
|
88 |
/** Worker routine for fetching bufs from the rcvqueue and sending them
|
89 |
/** Worker routine for fetching bufs from the rcvqueue and sending them
|
89 |
* further. The param is actually an AudioEater::Context */
|
90 |
* further. The param is actually an AudioEater::Context */
|
90 |
void *(*worker)(void *);
|
91 |
void *(*worker)(void *);
|
|
|
92 |
AudioState (*state)();
|
91 |
|
93 |
|
92 |
/** Packet counter. This is only used from the watcher thread to
|
94 |
/** Packet counter. This is only used from the watcher thread to
|
93 |
detect activity/inactivity, by polling every few seconds, so no
|
95 |
detect activity/inactivity, by polling every few seconds, so no
|
94 |
need to guard against wraparounds */
|
96 |
need to guard against wraparounds */
|
95 |
unsigned int pktcounter{0};
|
97 |
unsigned int pktcounter{0};
|