summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2005-10-27 14:08:28 +0000
committerdeva <deva>2005-10-27 14:08:28 +0000
commit971d1fdf8599dccdc604ed9374373af16af8354f (patch)
treeac8430951bb676cbf501702cff4450a555afe394
parent283599ea687e81855d78abffcbf641edb3bf02fb (diff)
*** empty log message ***
-rw-r--r--ChangeLog7
-rw-r--r--TODO8
-rw-r--r--etc/multicast.conf6
-rw-r--r--src/camera.cc9
-rw-r--r--src/encoder.cc2
-rw-r--r--src/mainwindow.cc11
-rw-r--r--src/mainwindow.h6
-rw-r--r--src/mov_encoder_writer.cc10
-rw-r--r--src/multicast.cc20
-rw-r--r--src/multicast.h9
-rw-r--r--src/multicast_configuration.cc20
-rw-r--r--src/multicast_configuration.h1
-rw-r--r--src/multiplexer.cc10
13 files changed, 88 insertions, 31 deletions
diff --git a/ChangeLog b/ChangeLog
index 0937c19..e71c86a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,9 +4,16 @@ Changelog for MIaV
=======================================
Oct XX 2005 - MIaV version 0.3.2
---------------------------------------
+
+********
+WARNING: Clients of the older versions ( < 0.3.2 ) are not compatible
+with this and newer releases, due to a change in the network header.
+********
+
New Features:
- Mute/Unmute button added to the gui.
- When muted, the audio signal is overwritten with a lowvolume 440Hz signal.
+ - The number of thumbnails shown are now calculated (no longer fixed to 3)
Bug Fixes:
- Font size of name label adjusted in mainwindow.
diff --git a/TODO b/TODO
index 7854ba7..2ee3feb 100644
--- a/TODO
+++ b/TODO
@@ -65,7 +65,7 @@ Mainwindow:
[x] - Realscale all window components.
[x] - Realscale all icons (use highresolution icons and scale them down)
[x] - Add mute/unmute buttons to the interface.
- [ ] - Calculate the number of screenshot thumbnails in the history.
+ [x] - Calculate the number of screenshot thumbnails in the history.
[ ] - Show the audio (muted/unmuted) status in the statusbar.
[ ] - Show recording status in the statusbar.
[ ] - Use QLinguist
@@ -138,6 +138,12 @@ MovEncoder:
[x] - Add ISO11172 multiplexing
[ ] - Double check the ISO11172 compliance.
+AudioEncoder:
+ [ ] -
+
+Multiplexer:
+ [ ] - Timecodes are stirred!
+
Main:
[x] - Save movie signal handling.
[x] - Read server root folder from config.
diff --git a/etc/multicast.conf b/etc/multicast.conf
index 9e9e067..8976ed4 100644
--- a/etc/multicast.conf
+++ b/etc/multicast.conf
@@ -5,6 +5,7 @@
# Enable multicasting on a globally
enabled = false
+with_audio = false
# Multicast adress:
# 224.0.0.1 All systems on this subnet
@@ -35,6 +36,9 @@ port=1234
# Enable for this client (locally)
enabled=yes
+# Broadcast both video and audio
+with_audio = true
+
#######################
## Client 2
##
@@ -45,3 +49,5 @@ client = "192.168.0.11"
# Multicast port
port=1235
+# Don't broadcast the audio.
+with_audio = false
diff --git a/src/camera.cc b/src/camera.cc
index 26a52a4..de017dc 100644
--- a/src/camera.cc
+++ b/src/camera.cc
@@ -83,11 +83,10 @@ Camera::~Camera()
// Signal to the threads to stop
running = 0;
- /* // FIXME: Add some way to stop a thread object
- pthread_join(decodetid, NULL);
- pthread_join(playertid, NULL);
- pthread_join(encodetid, NULL);
- */
+ // Wait for the threads to stop
+ decoder->wait_stop();
+ encoder->wait_stop();
+ player->wait_stop();
delete decoder;
delete encoder;
diff --git a/src/encoder.cc b/src/encoder.cc
index c46ca33..eb8c444 100644
--- a/src/encoder.cc
+++ b/src/encoder.cc
@@ -79,12 +79,14 @@ Encoder::Encoder(Info *ginfo,
Encoder::~Encoder()
{
// If a hanging connection exists, we better close it.
+ /* // Already deleted in thread_main
if(s) {
if(n) delete n;
delete s;
s = NULL;
n = NULL;
}
+ */
}
diff --git a/src/mainwindow.cc b/src/mainwindow.cc
index 87088b2..9ea5285 100644
--- a/src/mainwindow.cc
+++ b/src/mainwindow.cc
@@ -121,6 +121,7 @@ MainWindow::~MainWindow()
{
info->log("MIaV is shutting down.");
+ delete img_history;
delete camera;
delete btn_cpr;
@@ -262,7 +263,11 @@ void MainWindow::createGui()
int w = (int)((float)BUTTON_WIDTH * unit);
int h = (int)(576.0f / (720.0f / ((float)BUTTON_WIDTH * unit)));
- for(int i = 0; i < NUM_HISTORY; i++) {
+ int window_height = config->readInt("pixel_height");
+ this->num_history = (window_height - ((int)unit * BUTTON_HEIGHT)) / h;
+ img_history = new (HistoryWidget*)[this->num_history];
+
+ for(unsigned int i = 0; i < num_history; i++) {
img_history[i] = new HistoryWidget(gb);
img_history[i]->set_image(img_dummy);
img_history[i]->setFixedSize(w, h);
@@ -390,7 +395,7 @@ void MainWindow::clear()
// History widgets
- for(int i = 0; i < NUM_HISTORY; i++) {
+ for(unsigned int i = 0; i < num_history; i++) {
img_history[i]->set_image(img_dummy);
}
@@ -518,7 +523,7 @@ void MainWindow::shoot_clicked()
camera->snapshot(screenshot.bits());
QImage *image;
- for(int cnt = (NUM_HISTORY-1); cnt > 0; cnt--) {
+ for(int cnt = (num_history-1); cnt > 0; cnt--) {
image = img_history[cnt-1]->get_image();
img_history[cnt]->set_image(image);
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 617ac6b..56a5312 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -53,7 +53,7 @@ using namespace std;
/**
* First some GUI specs
*/
-#define NUM_HISTORY 3
+//#define NUM_HISTORY 3 // moved to a genuine variable
// Button sizes in cm (metric)
#define BUTTON_WIDTH 8
#define BUTTON_HEIGHT 2
@@ -114,6 +114,8 @@ public slots:
void mute_clicked();
private:
+ unsigned int num_history;
+
void clear();
Info *info;
@@ -153,7 +155,7 @@ private:
float rec_edge_counter;
QTimer *timer;
QLabel *img_recedge;
- HistoryWidget *img_history[NUM_HISTORY];
+ HistoryWidget **img_history;
QPushButton *btn_logo;
QPushButton *btn_clear;
diff --git a/src/mov_encoder_writer.cc b/src/mov_encoder_writer.cc
index 0d9081b..9bedba1 100644
--- a/src/mov_encoder_writer.cc
+++ b/src/mov_encoder_writer.cc
@@ -87,17 +87,17 @@ MovEncoderWriter::MovEncoderWriter(const char *clientip, const char* cpr,
mcastconf_t mcclientconf = mcconfig.getConf((char*)clientip);
- info->info("Client: %s - Enabled: %s - Addr: %s - Port: %d",
+ info->info("Client: %s - Enabled: %s - Addr: %s - Port: %d - WithAudio: %s",
mcclientconf.client.c_str(),
mcclientconf.enabled?"Yes\0":"No\0",
mcclientconf.addr.c_str(),
- mcclientconf.port);
+ mcclientconf.port,
+ mcclientconf.with_audio?"Yes\0":"No\0");
multicast = NULL;
if(mcclientconf.enabled) multicast = new Multicast(info,
- (char*)mcclientconf.addr.c_str(),
- mcclientconf.port);
+ mcclientconf);
video_queue = video_q;
audio_queue = audio_q;
@@ -116,7 +116,7 @@ void MovEncoderWriter::thread_main()
{
info->info("MovEncoderWriter::run");
- Multiplexer multiplexer(file, multicast,
+ Multiplexer multiplexer(file, multicast,
info, &running,
video_queue,
audio_queue);
diff --git a/src/multicast.cc b/src/multicast.cc
index ff3f557..0072c19 100644
--- a/src/multicast.cc
+++ b/src/multicast.cc
@@ -27,6 +27,8 @@
#include "config.h"
#include "multicast.h"
+#include "multicast_configuration.h"
+
#include "miav_config.h"
#include <sys/socket.h>
@@ -44,13 +46,18 @@
#include <errno.h>
-Multicast::Multicast(Info *i, char *addr, int port)
+Multicast::Multicast(Info *i, mcastconf_t &mcclientconf)
{
info = i;
udp_buffer = NULL;
-
+
+ multicast_audio = mcclientconf.with_audio;
+
// Open connection socket
- if(!UDPOpen(addr, port)) info->error("Error creating socket %s:%d", addr, port);
+ if(!UDPOpen(mcclientconf.addr.c_str(), mcclientconf.port))
+ info->error("Error creating socket %s:%d",
+ mcclientconf.addr.c_str(),
+ mcclientconf.port);
int mtu = config->readInt("udp_packet_size");
@@ -75,9 +82,9 @@ Multicast::~Multicast()
if(udp_buffer) delete udp_buffer;
}
-void Multicast::Write(void* buf, int size)
+int Multicast::Write(void* buf, int size)
{
- if(!udp_buffer) return; // no buffer to write in... better break out!
+ if(!udp_buffer) return 0; // no buffer to write in... better break out!
// info->info("To send: %d", size);
@@ -104,6 +111,7 @@ void Multicast::Write(void* buf, int size)
udp_buffer_pointer = udp_buffer;
}
}
+ return size;
}
bool Multicast::is_address_multicast(unsigned long address)
@@ -119,7 +127,7 @@ bool Multicast::is_address_multicast(unsigned long address)
/*
* open UDP socket
*/
-bool Multicast::UDPOpen(char *address, int port)
+bool Multicast::UDPOpen(const char *address, int port)
{
int enable = 1L;
struct sockaddr_in stAddr;
diff --git a/src/multicast.h b/src/multicast.h
index 3d222a0..08df3e1 100644
--- a/src/multicast.h
+++ b/src/multicast.h
@@ -28,20 +28,23 @@
#ifndef __MIAV_MULTICAST_H__
#define __MIAV_MULTICAST_H__
+#include "multicast_configuration.h"
#include "info.h"
class Multicast {
public:
- Multicast(Info *i, char *addr, int port);
+ Multicast(Info *i, mcastconf_t &mcclientconf);
~Multicast();
- void Write(void* buf, int size);
+ int Write(void* buf, int size);
+
+ bool multicast_audio;
private:
Info *info;
bool is_address_multicast(unsigned long address);
- bool UDPOpen(char *address, int port);
+ bool UDPOpen(const char *address, int port);
int sock;
int udp_buffer_size;
diff --git a/src/multicast_configuration.cc b/src/multicast_configuration.cc
index 8982f7a..969faca 100644
--- a/src/multicast_configuration.cc
+++ b/src/multicast_configuration.cc
@@ -32,9 +32,11 @@ MulticastConfiguration::MulticastConfiguration(Info *info, char *file)
{
mcastconf_t conf;
+ // Create the default values.
global_conf.addr = "224.0.0.1";
global_conf.port = 1234;
global_conf.enabled = false;
+ global_conf.with_audio = false;
bool global = true;
@@ -44,10 +46,14 @@ MulticastConfiguration::MulticastConfiguration(Info *info, char *file)
while(cfg) {
if(strcmp(cfg->name->c_str(), "client") == 0) {
if(!global) confs.push_back(conf);
+
+ // Reset the configuration to the defaults
conf.client = *(cfg->stringval);
conf.addr = global_conf.addr;
conf.port = global_conf.port;
conf.enabled = global_conf.enabled;
+ conf.with_audio = global_conf.with_audio;
+
global = false;
}
if(strcmp(cfg->name->c_str(), "address") == 0) {
@@ -62,22 +68,28 @@ MulticastConfiguration::MulticastConfiguration(Info *info, char *file)
if(global) global_conf.enabled = cfg->boolval;
else conf.enabled = cfg->boolval;
}
+ if(strcmp(cfg->name->c_str(), "with_audio") == 0) {
+ if(global) global_conf.with_audio = cfg->boolval;
+ else conf.with_audio = cfg->boolval;
+ }
cfg = cfg->next;
}
if(!global) confs.push_back(conf);
// Show the configuration in the log file .
- info->info("Global - Enabled: %s - Addr: %s - Port: %d",
+ info->info("Global - Enabled: %s - Addr: %s - Port: %d - WithAudio: %s",
global_conf.enabled?"Yes\0":"No\0",
global_conf.addr.c_str(),
- global_conf.port);
+ global_conf.port,
+ global_conf.with_audio?"Yes\0":"No\0");
for(unsigned int cnt = 0; cnt < confs.size(); cnt++) {
- info->info("Client: %s - Enabled: %s - Addr: %s - Port: %d",
+ info->info("Client: %s - Enabled: %s - Addr: %s - Port: %d - WithAudio: %s",
confs[cnt].client.c_str(),
confs[cnt].enabled?"Yes\0":"No\0",
confs[cnt].addr.c_str(),
- confs[cnt].port);
+ confs[cnt].port,
+ confs[cnt].with_audio?"Yes\0":"No\0");
}
info->info("Chosing:");
diff --git a/src/multicast_configuration.h b/src/multicast_configuration.h
index ef65c51..3fa7ef1 100644
--- a/src/multicast_configuration.h
+++ b/src/multicast_configuration.h
@@ -38,6 +38,7 @@ typedef struct {
std::string addr;
bool enabled;
int port;
+ bool with_audio;
} mcastconf_t;
class MulticastConfiguration : private MiavConfig {
diff --git a/src/multiplexer.cc b/src/multiplexer.cc
index 0b75723..0021c03 100644
--- a/src/multiplexer.cc
+++ b/src/multiplexer.cc
@@ -103,7 +103,7 @@ int Multiplexer::Write(void* data, int size)
{
int ret;
- if(multicast) multicast->Write(data, size);
+ if(multicast && multicast->multicast_audio == true) multicast->Write(data, size);
ret = file->Write(data, size);
return ret;
@@ -208,7 +208,13 @@ Frame *Multiplexer::getFrame(StreamType type)
read[type] = 0;
- return queue[type]->pop();
+ Frame *frame = queue[type]->pop();
+
+ // If we multicast without audio, we better write the raw video stream.
+ if(type == TYPE_VIDEO && multicast && multicast->multicast_audio == false)
+ multicast->Write(frame->data, frame->size);
+
+ return frame;
}
int Multiplexer::read_stream(char *buf, unsigned int size, StreamType type)