From 32183390270df57a49d932b9fe51012146ce154f Mon Sep 17 00:00:00 2001 From: deva Date: Wed, 16 Nov 2005 11:53:21 +0000 Subject: *** empty log message *** --- ChangeLog | 3 ++- TODO | 2 ++ etc/miav.conf | 2 ++ src/camera.cc | 1 + src/mainwindow.cc | 2 +- src/player.cc | 13 +++++++++++- src/player.h | 6 ++++++ src/yuv_draw.cc | 62 ++++++++++++++++++++++++++++++------------------------- src/yuv_draw.h | 6 ++++++ 9 files changed, 66 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 153086a..eded1b7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,7 +2,7 @@ Changelog for MIaV ======================================= -Oct XX 2005 - MIaV version 0.3.2 +Nov 16 2005 - MIaV version 0.3.2 --------------------------------------- ******** @@ -16,6 +16,7 @@ New Features: - The number of thumbnails shown are now calculated (no longer fixed to 3) - Added the mplex2 library as a dependency to the server. - Removed mplex2 library as a dependency to the server!!! (It didn't work as expected) + - Optimized yuv overlay code a bit... more to come! Bug Fixes: - New audio/video interleave algorithm... should fix sync (blip) problems diff --git a/TODO b/TODO index 2ee3feb..88a4099 100644 --- a/TODO +++ b/TODO @@ -70,6 +70,8 @@ Mainwindow: [ ] - Show recording status in the statusbar. [ ] - Use QLinguist [ ] - Test it. + [ ] - Reimplement freeze using a buffered image (so it does not disappear + when the window is redrawn) CPRQueryDialog: [x] - Make it! diff --git a/etc/miav.conf b/etc/miav.conf index 7c65300..b551d64 100644 --- a/etc/miav.conf +++ b/etc/miav.conf @@ -34,6 +34,8 @@ server_group = "miav" # Where to store the files recieved by the server server_movie_root = "/home/miav/miav_movie_files" server_image_root = "/home/miav/miav_image_files" +server_later = "/home/miav/miav_movie_files/deathrow" +server_trash = "/home/miav/miav_movie_files/trash" # Defines the size of the multicasted upd packages (1500 is normal) udp_packet_size = 1500 diff --git a/src/camera.cc b/src/camera.cc index de017dc..5dbec13 100644 --- a/src/camera.cc +++ b/src/camera.cc @@ -176,6 +176,7 @@ void Camera::resize(int w, int h, bool s) void Camera::setMute(bool mute) { decoder->setMute(mute); + player->setMute(mute); } #endif/* USE_GUI */ diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 1454b2e..3b407e8 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -295,7 +295,7 @@ void MainWindow::createGui() lbl_recordtime->setFixedWidth((int)(BUTTON_WIDTH * unit) + (gb->insideMargin() * 2) + g1->margin() * 2 + - g0->margin() * 2 + 100); + g0->margin() * 2); status->addWidget(lbl_recordtime, 0, TRUE); // About button diff --git a/src/player.cc b/src/player.cc index 58d3897..e57211d 100644 --- a/src/player.cc +++ b/src/player.cc @@ -79,6 +79,9 @@ Player::Player(Info *ginfo, recording = false; recording_prev = !recording; cprchanged = false; + + muted = false; + muted_prev = !muted; } Player::~Player() @@ -205,7 +208,10 @@ void Player::player() pitches); // Set status text - yuv_draw->mute(true); + // if(muted != muted_prev) { + yuv_draw->mute(muted); + // muted_prev = muted; + // } if(recording != recording_prev) { if(recording) yuv_draw->setTopText(TEXT_RECORDING); else yuv_draw->setTopText(TEXT_STOPPED); @@ -308,4 +314,9 @@ void Player::stoprecord() recording = false; } +void Player::setMute(bool m) +{ + muted = m; +} + #endif /* USE_GUI */ diff --git a/src/player.h b/src/player.h index 6d0cb15..0f5ca51 100644 --- a/src/player.h +++ b/src/player.h @@ -89,6 +89,8 @@ public: void thread_main(); + void setMute(bool mute); + private: void initSDL(); @@ -108,6 +110,10 @@ private: volatile bool showtext; volatile bool recording; bool recording_prev; + + volatile bool muted; + bool muted_prev; + volatile bool cprchanged; char cpr[256]; diff --git a/src/yuv_draw.cc b/src/yuv_draw.cc index bb8b23f..06aff5c 100644 --- a/src/yuv_draw.cc +++ b/src/yuv_draw.cc @@ -36,6 +36,26 @@ #define TEXT_MARGIN 10 +#include "mainwindow.h" +static QImage *loadIcon( char *name, int height ) +{ + QImage scaled; + QImage *img; + + img = new QImage(); + img->load( name ); + + int h = height; + int w = (int)((float)img->width() / (float)(img->height() / (float)h)); + + scaled = img->smoothScale(w, h); + delete img; + img = new QImage(scaled); + + return img; +} + + YUVDraw::YUVDraw() { overlay = NULL; @@ -56,6 +76,8 @@ YUVDraw::YUVDraw() } } + img_muted = loadIcon(PIXMAP_MUTE, ICON_HEIGHT); + img_unmuted = loadIcon(PIXMAP_UNMUTE, ICON_HEIGHT); } YUVDraw::~YUVDraw() @@ -93,12 +115,12 @@ void YUVDraw::setTopText(char* text) painter.begin(top_pixmap); painter.setFont( QFont( "Arial", 12, QFont::Bold ) ); painter.setPen( Qt::black ); - painter.drawText(0, 15, text); + painter.drawText(64, 15, text); painter.end(); QImage image = top_pixmap->convertToImage(); - for(int x = 0; x < 720 - TEXT_MARGIN; x++) { + for(int x = 64; x < 720 - TEXT_MARGIN; x++) { for(int y = 0; y < 20; y++) { top_grey[x][y] = qGray(image.pixel(x, y)); } @@ -143,39 +165,23 @@ void YUVDraw::draw() } } -static QImage *loadIcon( char *name, int height ) -{ - QImage scaled; - QImage *img; - - img = new QImage(); - img->load( name ); - - int h = height; - int w = (int)((float)img->width() / (float)(img->height() / (float)h)); - - scaled = img->smoothScale(w, h); - delete img; - img = new QImage(scaled); - - return img; -} -#include "mainwindow.h" void YUVDraw::mute(bool muted) { int xoffset = 0; int yoffset = 0; - int width = 48; - int height = 48; - QImage *img = loadIcon(PIXMAP_UNMUTE, height); + QImage *img; + if(muted) img = img_muted; + else img = img_unmuted; // Swicth the bool and draw an mute/unmute symbol - for(int x = 0; x < width; x++) { - for(int y = 0; y < height; y++) { - unsigned char color = qGray(img->pixel(x, y)); - if(!qAlpha(img->pixel(x, y))) color = 0; - addPixel(x + xoffset, y + yoffset, color); + float alpha, color; + + for(int x = 0; x < ICON_WIDTH; x++) { + for(int y = 0; y < ICON_HEIGHT; y++) { + alpha = ((float)qAlpha(img->pixel(x, y)) / 255.0); + color = (float)qGray(img->pixel(x, y)) * alpha; + addPixel(x + xoffset, y + yoffset, (unsigned char)color); } } } diff --git a/src/yuv_draw.h b/src/yuv_draw.h index 651eb8e..62f7d02 100644 --- a/src/yuv_draw.h +++ b/src/yuv_draw.h @@ -35,6 +35,9 @@ #include #include +#define ICON_HEIGHT 48 +#define ICON_WIDTH 48 + class YUVDraw { public: YUVDraw(); @@ -58,6 +61,9 @@ private: QPixmap *bottom_pixmap; unsigned char bottom_grey[720][20]; + + QImage *img_muted; + QImage *img_unmuted; }; #endif/*__MIAV_YUV_DRAW_H__*/ -- cgit v1.2.3