summaryrefslogtreecommitdiff
path: root/src/encoder.cc
diff options
context:
space:
mode:
authordeva <deva>2005-05-02 09:50:22 +0000
committerdeva <deva>2005-05-02 09:50:22 +0000
commit837ca942fafaf9a4a1f69c6d595616a92ebeb203 (patch)
treee2c1ee8bb6c3f51dbff27ad589c7764e16db7081 /src/encoder.cc
parentcaa613c4a19736ed56731e3786847bd5ee37dc11 (diff)
Rewrote freeze, shoot and record flags, from encoder to frame.
Diffstat (limited to 'src/encoder.cc')
-rw-r--r--src/encoder.cc40
1 files changed, 25 insertions, 15 deletions
diff --git a/src/encoder.cc b/src/encoder.cc
index d1d9362..cbafb99 100644
--- a/src/encoder.cc
+++ b/src/encoder.cc
@@ -25,6 +25,9 @@
*/
/*
* $Log$
+ * Revision 1.21 2005/05/02 09:50:22 deva
+ * Rewrote freeze, shoot and record flags, from encoder to frame.
+ *
* Revision 1.20 2005/05/02 09:18:13 deva
*
* Fixed decoding problem in snapshot thumbnails.
@@ -70,17 +73,17 @@ Encoder::Encoder(Error* err,
mutex = gmutex;
running = grunning;
- record = 0;
+ // record = 0;
sem_init(&record_sem, 0, 0);
s = NULL;
n = NULL;
- shoot_request = 0;
- shoot_value = 0;
- freeze_request = 0;
- freeze_value = 0;
+ // shoot_request = 0;
+ // shoot_value = 0;
+ // freeze_request = 0;
+ // freeze_value = 0;
}
@@ -101,20 +104,25 @@ void Encoder::encode()
frame = queue->pop();
if(frame) {
+ /*
if(record ||
(freeze_request != freeze_value) ||
(shoot_request != shoot_value)) {
+ */
+ if(frame->record ||
+ frame->freeze ||
+ frame->shoot) {
n_header h;
h.header_type = DATA_HEADER;
sprintf(h.header.h_data.cpr, cpr);
- h.header.h_data.freeze = (freeze_request != freeze_value);
- h.header.h_data.snapshot = (shoot_request != shoot_value);
- h.header.h_data.record = record;
+ h.header.h_data.freeze = frame->freeze;
+ h.header.h_data.snapshot = frame->shoot;
+ h.header.h_data.record = frame->record;
h.header.h_data.savestate = NO_CHANGE;
- if(freeze_request != freeze_value) freeze_value = freeze_request;
- if(shoot_request != shoot_value) shoot_value = shoot_request;
+ // if(freeze_request != freeze_value) freeze_value = freeze_request;
+ // if(shoot_request != shoot_value) shoot_value = shoot_request;
n->sendPackage(&h, frame->data, frame->size);
}
@@ -137,7 +145,7 @@ void Encoder::freeze()
s->sconnect(ip);
n = new Network(s, errobj);
}
- if(!errobj->hasError()) freeze_request = 1 - freeze_request;
+ // if(!errobj->hasError()) freeze_request = 1 - freeze_request;
}
@@ -153,7 +161,7 @@ void Encoder::shoot(unsigned char *rgb)
s->sconnect(ip);
n = new Network(s, errobj);
}
- if(!errobj->hasError()) shoot_request = 1 - shoot_request;
+ // if(!errobj->hasError()) shoot_request = 1 - shoot_request;
getScreenshot(rgb);
}
@@ -170,11 +178,12 @@ void Encoder::start() {
s->sconnect(ip);
n = new Network(s, errobj);
}
- if(!errobj->hasError()) record = 1;
+ // if(!errobj->hasError()) record = 1;
}
void Encoder::stop(n_savestate save) {
+/*
struct timespec ts;
// TODO: set save state in package header.
@@ -182,8 +191,8 @@ void Encoder::stop(n_savestate save) {
queue->lock();
fprintf(stderr, "Emptying queue"); fflush(stderr);
while(queue->peek()) {
- /* Remove any late buffer */
- /* We don't care, the encoder finishes them all */
+ // Remove any late buffer
+ // We don't care, the encoder finishes them all
ts.tv_sec = 0;
ts.tv_nsec = 500000000L; // 100ms
fprintf(stderr, "."); fflush(stderr);
@@ -194,6 +203,7 @@ void Encoder::stop(n_savestate save) {
record = 0;
queue->unlock();
+*/
if(s) {
if(n) delete n;
delete s;