summaryrefslogtreecommitdiff
path: root/src/mov_encoder_thread.cc
diff options
context:
space:
mode:
authordeva <deva>2005-05-17 19:16:26 +0000
committerdeva <deva>2005-05-17 19:16:26 +0000
commit511b49048fb62a56f7049045e0e3d85c5b3e8745 (patch)
tree989b7b2cbe69f226c3c1282f486a6aa13ce9b6a5 /src/mov_encoder_thread.cc
parentc3ac81724d3d73925a23f3ea41f14c3d557d92a5 (diff)
Made new mpeg writer work, with proper file permissions.
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;
}