diff options
author | deva <deva> | 2006-05-20 14:35:59 +0000 |
---|---|---|
committer | deva <deva> | 2006-05-20 14:35:59 +0000 |
commit | dd8e7832c69a5ef484a2f3b6054a482d29275f85 (patch) | |
tree | 6865f4f18d8545a0edecbb3646f69039ccc82727 /client/networksender.cc | |
parent | 60c43b0a065175a49ae0aa2b10280e893479889b (diff) |
*** empty log message ***
Diffstat (limited to 'client/networksender.cc')
-rw-r--r-- | client/networksender.cc | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/client/networksender.cc b/client/networksender.cc index 21c107c..675bdb9 100644 --- a/client/networksender.cc +++ b/client/networksender.cc @@ -28,28 +28,46 @@ #include "info.h" -NetworkSender::NetworkSender() +NetworkSender::NetworkSender(QString cpr) { ip = "192.168.0.10"; port = 6666; + + // Connect } NetworkSender::~NetworkSender() -{} - -void NetworkSender::newConnection(char *cpr) { + // Disconnect } -void NetworkSender::pushFrame(char* frame, bool freeze, bool snapshot) +void NetworkSender::pushFrame(char* framedata, bool freeze, bool snapshot) { -} + Frame *frame = new Frame((unsigned char*)framedata); + frame->freeze = freeze; + frame->shoot = snapshot; -void NetworkSender::endConnection() -{ + mutex.lock(); + framelist.push_back(frame); + mutex.unlock(); + + semaphore.release(); } void NetworkSender::run() { - // MIaV::info->info("The NetworkSender thread is running."); + while(running) { + semaphore.acquire(); + + Frame *frame = NULL; + mutex.lock(); + if(framelist.isEmpty() == false) frame = framelist.takeLast(); + mutex.unlock(); + + if(frame) { + // TODO: Send it over the network + + delete frame; + } + } } |