summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordeva <deva>2005-11-16 11:53:21 +0000
committerdeva <deva>2005-11-16 11:53:21 +0000
commit32183390270df57a49d932b9fe51012146ce154f (patch)
tree2b5095cb11412e29e612a26b3feb7ed5dc8e9cb5 /src
parent2ec93410616c86a3fd0e4464d34c4b5da77b13d5 (diff)
*** empty log message ***
Diffstat (limited to 'src')
-rw-r--r--src/camera.cc1
-rw-r--r--src/mainwindow.cc2
-rw-r--r--src/player.cc13
-rw-r--r--src/player.h6
-rw-r--r--src/yuv_draw.cc62
-rw-r--r--src/yuv_draw.h6
6 files changed, 60 insertions, 30 deletions
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 <qimage.h>
#include <qpainter.h>
+#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__*/