summaryrefslogtreecommitdiff
path: root/src/mov_encoder_thread.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/mov_encoder_thread.cc')
-rw-r--r--src/mov_encoder_thread.cc24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/mov_encoder_thread.cc b/src/mov_encoder_thread.cc
index 63c0bd2..da83744 100644
--- a/src/mov_encoder_thread.cc
+++ b/src/mov_encoder_thread.cc
@@ -31,6 +31,10 @@
/*
* $Log$
+ * Revision 1.4 2005/05/17 19:16:26 deva
+ *
+ * Made new mpeg writer work, with proper file permissions.
+ *
* Revision 1.3 2005/05/17 15:13:15 deva
* *** empty log message ***
*
@@ -44,11 +48,17 @@
#include <config.h>
#include "mov_encoder_thread.h"
+#include <errno.h>
MovEncoderThread::MovEncoderThread(const char *filename)
{
- file = open(filename, O_CREAT | O_EXCL, S_IRWXU | S_IRGRP | S_IROTH);
-
+ file = open(filename,
+ O_CREAT | O_WRONLY, //| O_LARGEFILE
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
+ if(file == -1) {
+ fprintf(stderr, "File not opened %s\n", strerror(errno));
+ return;
+ }
threads = 4;
for(int cnt = 0; cnt < threads; cnt++) {
@@ -61,13 +71,17 @@ MovEncoderThread::~MovEncoderThread()
for(int cnt = 0; cnt < threads; cnt++) {
delete encs[cnt];
}
- if(file) close(file);
+ if(file != -1) close(file);
}
void MovEncoderThread::encode(Frame* frame)
{
- if(!file) return;
+ if(file == -1) return;
+
Frame *enc_frame = encs[0]->encode(frame);
- write(file, enc_frame->data, enc_frame->size);
+ // fprintf(stderr, "[%d]", enc_frame->size); fflush(stderr);
+ int i = write(file, enc_frame->data, enc_frame->size);
+ if(i == -1) perror("Write failed");
+ delete enc_frame;
}