From 2ec93410616c86a3fd0e4464d34c4b5da77b13d5 Mon Sep 17 00:00:00 2001 From: deva Date: Wed, 16 Nov 2005 11:02:28 +0000 Subject: *** empty log message *** --- src/encoder.cc | 2 ++ src/libmplex_wrapper.cc | 3 +++ src/libmplex_wrapper.h | 3 +++ src/mainwindow.cc | 19 ++++++++++++++----- src/mainwindow.h | 3 +++ src/mov_encoder_writer.cc | 16 ++++++++-------- src/multiplexer.cc | 13 +++++++++++-- src/server.cc | 2 +- 8 files changed, 45 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/encoder.cc b/src/encoder.cc index eb8c444..e7b79bf 100644 --- a/src/encoder.cc +++ b/src/encoder.cc @@ -126,6 +126,8 @@ void Encoder::encode() h.header.h_data.record = frame->record; h.header.h_data.savestate = savestate;//NO_CHANGE; h.header.h_data.mute = frame->mute; + + savestate = NO_CHANGE; // only transmit once! // if(freeze_request != freeze_value) freeze_value = freeze_request; // if(shoot_request != shoot_value) shoot_value = shoot_request; diff --git a/src/libmplex_wrapper.cc b/src/libmplex_wrapper.cc index a93b4a9..4164ffe 100644 --- a/src/libmplex_wrapper.cc +++ b/src/libmplex_wrapper.cc @@ -28,6 +28,8 @@ #include "libmplex_wrapper.h" #include "miav_config.h" +#ifdef WITH_LIBMPLEX + #include #include #include @@ -480,3 +482,4 @@ int main (int argc, char* argv[]) } #endif/*LIBMPLEX_WRAPPER_TEST*/ +#endif/*WITH_LIBMPLEX*/ diff --git a/src/libmplex_wrapper.h b/src/libmplex_wrapper.h index 8591563..1be71a1 100644 --- a/src/libmplex_wrapper.h +++ b/src/libmplex_wrapper.h @@ -28,6 +28,8 @@ #ifndef __MIAV_LIBMPLEX_WRAPPER_H__ #define __MIAV_LIBMPLEX_WRAPPER_H__ +#ifdef WITH_LIBMPLEX + #include "info.h" #include "file.h" #include "threadsafe_queue_priority.h" @@ -48,5 +50,6 @@ private: ThreadSafeQueuePriority *video_queue; ThreadSafeQueuePriority *audio_queue; }; +#endif/*WITH_LIBMPLEX*/ #endif/*__MIAV_LIBMPLEX_WRAPPER_H__*/ diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 279fab6..1454b2e 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -193,17 +193,22 @@ void MainWindow::createGui() // QGridLayout *g2 = new QGridLayout(1, NUM_HISTORY, -1); // QVBoxLayout *g2 = new QVBoxLayout(this); // g0->addLayout(g2, 0, 1); - gb->setInsideMargin(25); + + gb->setInsideMargin(HISTORY_LIST_MARGIN); + gb->setInsideSpacing(HISTORY_LIST_SPACING); gb->setFlat(true); g0->addWidget(gb, 0, 1); - int output_width = this->width() - + int resolution_w = config->readInt("pixel_width"); + int resolution_h = config->readInt("pixel_height"); + + int output_width = resolution_w - // this->width() - (int)(BUTTON_WIDTH * unit) - (gb->insideMargin() * 2) - g1->margin() * 2 - g0->margin() * 2; - int output_height = this->height() - + int output_height = resolution_h - // this->height() - (int)(3 * BUTTON_HEIGHT * unit) - g1->margin() * 5 - g0->margin() * 3; @@ -264,7 +269,9 @@ void MainWindow::createGui() int h = (int)(576.0f / (720.0f / ((float)BUTTON_WIDTH * unit))); int window_height = config->readInt("pixel_height"); - this->num_history = (window_height - ((int)unit * BUTTON_HEIGHT)) / h; + this->num_history = (window_height - + ((int)unit * BUTTON_HEIGHT + HISTORY_LIST_SPACING ) - + (2 * HISTORY_LIST_MARGIN)) / (h + HISTORY_LIST_SPACING); img_history = new (HistoryWidget*)[this->num_history]; for(unsigned int i = 0; i < num_history; i++) { @@ -288,7 +295,7 @@ void MainWindow::createGui() lbl_recordtime->setFixedWidth((int)(BUTTON_WIDTH * unit) + (gb->insideMargin() * 2) + g1->margin() * 2 + - g0->margin() * 2); + g0->margin() * 2 + 100); status->addWidget(lbl_recordtime, 0, TRUE); // About button @@ -321,6 +328,7 @@ QPushButton *MainWindow::createButton(char *caption, QWidget *parent, int width, QPushButton *btn = new QPushButton(caption, parent); btn->setFont( QFont( "Sans Serif", (int)(unit * height / 2), QFont::Bold ) ); btn->setFixedHeight((int)(unit * height)); + btn->setFixedWidth((int)(unit * width)); return btn; } @@ -333,6 +341,7 @@ QLabel *MainWindow::createLabel(char *caption, int width, int height) (int)(unit * height / 2), (height>1)?QFont::Bold:QFont::Normal ) ); lbl->setFixedHeight((int)(unit * height)); + // lbl->setFixedWidth((int)(unit * width)); return lbl; } diff --git a/src/mainwindow.h b/src/mainwindow.h index 56a5312..e95933d 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -58,6 +58,9 @@ using namespace std; #define BUTTON_WIDTH 8 #define BUTTON_HEIGHT 2 +#define HISTORY_LIST_MARGIN 25 +#define HISTORY_LIST_SPACING 5 + /** * Textstrings */ diff --git a/src/mov_encoder_writer.cc b/src/mov_encoder_writer.cc index e831b9e..1773527 100644 --- a/src/mov_encoder_writer.cc +++ b/src/mov_encoder_writer.cc @@ -117,19 +117,19 @@ void MovEncoderWriter::thread_main() { info->info("MovEncoderWriter::run"); - Multiplexer multiplexer(file, multicast, - info, &running, - video_queue, - audio_queue); - multiplexer.multiplex(); - - /* +#ifdef WITH_LIBMPLEX LibMPlexWrapper mplex(info, file, video_queue, audio_queue); mplex.multiplex(); - */ +#else/*WITH_LIBMPLEX*/ + Multiplexer multiplexer(file, multicast, + info, &running, + video_queue, + audio_queue); + multiplexer.multiplex(); +#endif/*WITH_LIBMPLEX*/ info->info("MovEncoderWriter::stop"); } diff --git a/src/multiplexer.cc b/src/multiplexer.cc index 0021c03..7a8b095 100644 --- a/src/multiplexer.cc +++ b/src/multiplexer.cc @@ -301,13 +301,22 @@ bool Multiplexer::packet() //info->info("\t\tWritten[A]: %f, Written[V]: %f", written[TYPE_AUDIO], written[TYPE_VIDEO]); StreamType type; - + /* // New switching mechanism - if(written[TYPE_AUDIO] < written[TYPE_VIDEO] + 10) { + if(written[TYPE_AUDIO] < written[TYPE_VIDEO]) { type = TYPE_AUDIO; } else { type = TYPE_VIDEO; } + */ + + // Newer switching mechanism + if(queue[TYPE_AUDIO]->size() > queue[TYPE_VIDEO]->size()) { + type = TYPE_AUDIO; + } else { + type = TYPE_VIDEO; + } + if(!packet(type)) { // Flush the other stream too... diff --git a/src/server.cc b/src/server.cc index fc06a1d..34aac7b 100644 --- a/src/server.cc +++ b/src/server.cc @@ -100,7 +100,7 @@ void newConnection(Socket *socket, Info *info) } } - if(h.header.h_data.savestate) { + if(h.header.h_data.savestate != NO_CHANGE) { savestate = h.header.h_data.savestate; info->info("GOT SAVESTATE FROM NETWORK: %d", savestate ); } -- cgit v1.2.3