diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mov_encoder.cc | 2 | ||||
-rw-r--r-- | src/mov_encoder.h | 4 | ||||
-rw-r--r-- | src/mov_encoder_thread.cc | 3 | ||||
-rw-r--r-- | src/mov_encoder_thread.h | 2 | ||||
-rw-r--r-- | src/threadsafe_queue_fifo.cc | 23 | ||||
-rw-r--r-- | src/threadsafe_queue_fifo.h | 12 |
6 files changed, 22 insertions, 24 deletions
diff --git a/src/mov_encoder.cc b/src/mov_encoder.cc index a455f42..1132b63 100644 --- a/src/mov_encoder.cc +++ b/src/mov_encoder.cc @@ -45,7 +45,7 @@ #include "libfame_wrapper.h" MovEncoder::MovEncoder(volatile bool *r, sem_t *r_sem, - ThreadSafeQueueFIFO<FrameVector*> *in, + ThreadSafeQueueFIFO *in, ThreadSafeQueuePriority *video_out, ThreadSafeQueuePriority *audio_out, Info *i) diff --git a/src/mov_encoder.h b/src/mov_encoder.h index ace016c..8910f4b 100644 --- a/src/mov_encoder.h +++ b/src/mov_encoder.h @@ -54,7 +54,7 @@ using namespace std; class MovEncoder : public Thread { public: MovEncoder(volatile bool *r, sem_t *r_sem, - ThreadSafeQueueFIFO< FrameVector*> *in, + ThreadSafeQueueFIFO *in, ThreadSafeQueuePriority *video_out, ThreadSafeQueuePriority *audio_out, Info *info); @@ -68,7 +68,7 @@ private: Info *info; // Input queue - ThreadSafeQueueFIFO< FrameVector* > *inputqueue; + ThreadSafeQueueFIFO *inputqueue; // Output queues ThreadSafeQueuePriority *video_output_queue; diff --git a/src/mov_encoder_thread.cc b/src/mov_encoder_thread.cc index 7c7f5d9..2e4c16b 100644 --- a/src/mov_encoder_thread.cc +++ b/src/mov_encoder_thread.cc @@ -35,7 +35,8 @@ MovEncoderThread::MovEncoderThread(const char *cpr, Info *i) info->info("MovEncoderThread"); // Queue - inputqueue = new ThreadSafeQueueFIFO<FrameVector*>(); + // inputqueue = new ThreadSafeQueueFIFO<FrameVector*>(); + inputqueue = new ThreadSafeQueueFIFO(); // Initialize read semaphore sem_init(&read_sem, 0, 0); diff --git a/src/mov_encoder_thread.h b/src/mov_encoder_thread.h index 8cc24f8..3e7c1aa 100644 --- a/src/mov_encoder_thread.h +++ b/src/mov_encoder_thread.h @@ -58,7 +58,7 @@ private: Info *info; // FrameVectorQueue *inputqueue; - ThreadSafeQueueFIFO< FrameVector* > *inputqueue; + ThreadSafeQueueFIFO *inputqueue; FrameVector *block; //thread stuff diff --git a/src/threadsafe_queue_fifo.cc b/src/threadsafe_queue_fifo.cc index 50c1067..6dbcb67 100644 --- a/src/threadsafe_queue_fifo.cc +++ b/src/threadsafe_queue_fifo.cc @@ -27,43 +27,38 @@ #include "config.h" #include "threadsafe_queue_fifo.h" -template <typename T> -ThreadSafeQueueFIFO<T>::ThreadSafeQueueFIFO() +ThreadSafeQueueFIFO::ThreadSafeQueueFIFO() { } -template <typename T> -ThreadSafeQueueFIFO<T>::~ThreadSafeQueueFIFO() +ThreadSafeQueueFIFO::~ThreadSafeQueueFIFO() { } -template <typename T> -void ThreadSafeQueueFIFO<T>::push(T t) +void ThreadSafeQueueFIFO::push(FrameVector *framevector) { mutex.lock(); - queue.push(t); + queue.push(framevector); mutex.unlock(); semaphore.post(); } -template <typename T> -T ThreadSafeQueueFIFO<T>::pop() +FrameVector *ThreadSafeQueueFIFO::pop() { semaphore.wait(); - T t; + FrameVector *framevector; mutex.lock(); - t = queue.front(); + framevector = queue.front(); queue.pop(); mutex.unlock(); - return t; + return framevector; } -template <typename T> -int ThreadSafeQueueFIFO<T>::size() +int ThreadSafeQueueFIFO::size() { int sz; diff --git a/src/threadsafe_queue_fifo.h b/src/threadsafe_queue_fifo.h index 9baf82e..ee3ac3b 100644 --- a/src/threadsafe_queue_fifo.h +++ b/src/threadsafe_queue_fifo.h @@ -29,20 +29,22 @@ #define __MIAV_THREADSAFE_QUEUE_FIFO_H__ #include "threadsafe_queue.h" + +#include "frame.h" + #include <queue> -template <typename T> -class ThreadSafeQueueFIFO: public ThreadSafeQueue<T> { +class ThreadSafeQueueFIFO: public ThreadSafeQueue<FrameVector*> { public: ThreadSafeQueueFIFO(); ~ThreadSafeQueueFIFO(); - void push(T t); - T pop(); + void push(FrameVector* framevector); + FrameVector* pop(); int size(); private: - std::queue<T> queue; + std::queue<FrameVector*> queue; }; #endif/*__MIAV_THREADSAFE_QUEUE_FIFO_H__*/ |