summaryrefslogtreecommitdiff
path: root/src/mov_encoder_writer.cc
diff options
context:
space:
mode:
authordeva <deva>2005-06-19 20:04:43 +0000
committerdeva <deva>2005-06-19 20:04:43 +0000
commit6d7a1f124f38a4358f517437757f6f0c3fe21d8b (patch)
tree48beeb9589d50b8293ca71473a3e344036872cfa /src/mov_encoder_writer.cc
parent52fd913be8b044f1d064973c53b4467e5bd153fe (diff)
ImgEncoder now uses the file class for output, through jpeg_mem_dest.
Diffstat (limited to 'src/mov_encoder_writer.cc')
-rw-r--r--src/mov_encoder_writer.cc74
1 files changed, 16 insertions, 58 deletions
diff --git a/src/mov_encoder_writer.cc b/src/mov_encoder_writer.cc
index a10d671..1c0fe1b 100644
--- a/src/mov_encoder_writer.cc
+++ b/src/mov_encoder_writer.cc
@@ -31,6 +31,9 @@
/*
* $Log$
+ * Revision 1.7 2005/06/19 20:04:43 deva
+ * ImgEncoder now uses the file class for output, through jpeg_mem_dest.
+ *
* Revision 1.6 2005/06/16 21:28:57 deva
* Rewrote thread object
* Fixed bug in mov_encoder (pushed read_sem too many times, whihc lead to
@@ -131,88 +134,43 @@ void MovEncoderWriter::thread_main()
while(running) {
sem_wait(sem);
+ // int poolsize;
+
// Lock output mutex
pthread_mutex_lock(mutex);
frame = queue->top();
if(frame && frame->number == frame_number) queue->pop();
+ // poolsize = queue->size();
pthread_mutex_unlock(mutex);
// Unlock output mutex
+ int wrote = 0;
while(frame && (frame->number == frame_number)) {
+
int ret;
ret = file->Write(frame->data, frame->size);
+ frame_number++;
+ wrote ++;
delete frame;
- if(ret == -1) return;
+ if(ret == -1) {
+ info->error("File write returned -1.");
+ return;
+ }
- frame_number++;
-
// Lock output mutex
pthread_mutex_lock(mutex);
frame = queue->top();
if(frame && frame->number == frame_number) queue->pop();
+ // poolsize = queue->size();
pthread_mutex_unlock(mutex);
// Unlock output mutex
}
- }
-
- info->info("MovEncoderWriter::stop");
-}
-
-/*
-void MovEncoderWriter::thread_main()
-{
- unsigned int howdeep = 0;
- info->info("MovEncoderWriter::run");
-
- Frame *frame;
-
- while(running) {
- sem_wait(sem);
- howdeep++;
-
- // Lock output mutex
- pthread_mutex_lock(mutex);
- if(queue->size() == 0) {
- info->warn("1MovEncoderWriter encountered an empty queue (This shouldn't happen).");
- // Unlock output mutex
- pthread_mutex_unlock(mutex);
- continue;
- }
- frame = queue->top();
- if(frame->number == frame_number) queue->pop();
- pthread_mutex_unlock(mutex);
- // Unlock output mutex
-
- while((frame->number == frame_number) && howdeep) {
- howdeep--;
- int ret;
-
- ret = file->Write(frame->data, frame->size);
-
- delete frame;
-
- if(ret == -1) return;
-
- frame_number++;
-
- // Lock output mutex
- pthread_mutex_lock(mutex);
- if(queue->size() == 0) {
- info->warn("2MovEncoderWriter encountered an empty queue (This shouldn't happen).");
- pthread_mutex_unlock(mutex);
- continue;
- }
- frame = queue->top();
- if(frame->number == frame_number) queue->pop();
- pthread_mutex_unlock(mutex);
- // Unlock output mutex
- }
+ // info->info("Wrote %d frames, pool size %d - exp: %d", wrote, poolsize, frame_number);
}
info->info("MovEncoderWriter::stop");
}
-*/