summaryrefslogtreecommitdiff
path: root/src/mov_encoder.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mov_encoder.h')
-rw-r--r--src/mov_encoder.h40
1 files changed, 23 insertions, 17 deletions
diff --git a/src/mov_encoder.h b/src/mov_encoder.h
index 13eb63b..d7e0c17 100644
--- a/src/mov_encoder.h
+++ b/src/mov_encoder.h
@@ -36,19 +36,19 @@
/*
* $Log$
- * Revision 1.9 2005/05/19 14:10:22 deva
+ * Revision 1.10 2005/05/22 15:49:22 deva
+ * Added multithreaded encoding support.
*
+ * Revision 1.9 2005/05/19 14:10:22 deva
* Multithreading rulez?
*
* Revision 1.8 2005/05/17 14:30:56 deva
* Added code, preparing threaded encoding.
*
* Revision 1.7 2005/05/09 16:40:20 deva
- *
* Added optimize yuv conversion code
*
* Revision 1.6 2005/05/05 20:41:38 deva
- *
* Removed the last pieces of ffmpeg... replaced it with libfame...
* Not quite working yet, but all the major code is in place!
*
@@ -66,6 +66,7 @@
#include <stdlib.h>
#include <string.h>
+
// Use libfame
#include <fame.h>
@@ -73,52 +74,57 @@
#include <libdv/dv.h>
#include <libdv/dv_types.h>
+#include <vector>
+using namespace std;
+
#include "frame.h"
-#include "queue.h"
#include "util.h"
#include "thread.h"
+#include <pthread.h>
// size specifies the length of the buffer.
#define FAME_BUFFER_SIZE (2*720*576*4) // FIXME: One size fits all...
class MovEncoder : public Thread {
public:
- MovEncoder();
+ MovEncoder(sem_t *r_sem,
+ FrameVectorQueue *in, sem_t *in_sem, pthread_mutex_t *in_mutex,
+ FramePriorityQueue *out, sem_t *out_sem, pthread_mutex_t *out_mutex);
~MovEncoder();
Frame* encode(Frame *frame);
void run();
- Queue<Frame> *getResultSequence();
- void encodeSequence(Queue<Frame> *queue);
-
volatile bool running;
private:
- // Input queue
- Queue<Frame> *inputqueue;
- Queue<Frame> *outputqueue;
+ // Input/Output queues
+ FrameVectorQueue *inputqueue;
+ FramePriorityQueue *outputqueue;
//thread stuff
- sem_t sem;
- sem_t done;
+ sem_t *input_sem;
+ sem_t *output_sem;
+
+ sem_t *read_sem;
+ pthread_mutex_t *input_mutex;
+ pthread_mutex_t *output_mutex;
+
Frame *encode_video(Frame *frame);
void encode_audio(Frame *frame);
- // buffer is the buffer where encoded data will be written to. It must be large
- // enough to contain a few frames.
+ // libFAME encoder
unsigned char *fame_buffer;
fame_parameters_t fame_par;
fame_context_t *fame_context;
fame_yuv_t yuv;
- FILE *f;
// libdv decoder
dv_decoder_t *dvdecoder;
- unsigned char rgb[FAME_BUFFER_SIZE];
+ unsigned char picture[FAME_BUFFER_SIZE];
};
#endif