summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-04-24 15:42:37 (UTC)
committer mickeyl <mickeyl>2003-04-24 15:42:37 (UTC)
commitc57a19971e2f43b3a5cdfe525d755ac6603c3676 (patch) (side-by-side diff)
tree346e52e769471a7a61c52aaa2ddbb899c883f196
parent9671975e21266e3bfa6f3c793a3278b67cea34b7 (diff)
downloadopie-c57a19971e2f43b3a5cdfe525d755ac6603c3676.zip
opie-c57a19971e2f43b3a5cdfe525d755ac6603c3676.tar.gz
opie-c57a19971e2f43b3a5cdfe525d755ac6603c3676.tar.bz2
slight bugfixes, even more debugging output (only in debugging mode), version = 1.0
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/camera/imageio.cpp2
-rw-r--r--noncore/multimedia/camera/mainwindow.cpp44
-rw-r--r--noncore/multimedia/camera/opie-camera.control2
3 files changed, 38 insertions, 10 deletions
diff --git a/noncore/multimedia/camera/imageio.cpp b/noncore/multimedia/camera/imageio.cpp
index f8f5dd0..ed0d39f 100644
--- a/noncore/multimedia/camera/imageio.cpp
+++ b/noncore/multimedia/camera/imageio.cpp
@@ -41,15 +41,15 @@ void bufferToImage( int _width, int _height, unsigned char* bp, QImage* image )
void imageToFile( QImage* i, const QString& name, const QString& format, int quality )
{
QImage im = i->convertDepth( 32 );
bool result = im.save( name, format, quality );
if ( !result )
{
- oerr << "imageio-Problem while writing." << oendl;
+ oerr << "imageio-Problem while writing to " << name << oendl;
}
else
{
odebug << format << "-image has been successfully captured" << oendl;
}
} \ No newline at end of file
diff --git a/noncore/multimedia/camera/mainwindow.cpp b/noncore/multimedia/camera/mainwindow.cpp
index 16ee8bc..49c7cbf 100644
--- a/noncore/multimedia/camera/mainwindow.cpp
+++ b/noncore/multimedia/camera/mainwindow.cpp
@@ -153,19 +153,19 @@ void CameraMainWindow::init()
( new QAction( "Auto (recommended)", 0, 0, flipg, 0, true ) )->setOn( true );
new QAction( "0 (always off)", 0, 0, flipg, 0, true );
new QAction( "X (always horizontal)", 0, 0, flipg, 0, true );
new QAction( "Y (always vertical)", 0, 0, flipg, 0, true );
new QAction( "* (always both)", 0, 0, flipg, 0, true );
outputTog = new QActionGroup( 0, "output", true );
outputTog->setToggleAction( true );
- new QAction( "/tmp", 0, 0, outputTog, 0, true );
+ new QAction( "/tmp/", 0, 0, outputTog, 0, true );
new QAction( "/mnt/card/", 0, 0, outputTog, 0, true );
- new QAction( "/mnt/sd/", 0, 0, outputTog, 0, true );
+ new QAction( "/mnt/cf/", 0, 0, outputTog, 0, true );
docfolder = new QAction( "Documents Folder", 0, 0, outputTog, 0, true );
docfolder->setOn( true );
custom = new QAction( "&Custom...", 0, 0, outputTog, 0, true );
outputg = new QActionGroup( 0, "output", true );
outputg->setToggleAction( true );
( new QAction( "JPEG", 0, 0, outputg, 0, true ) )->setOn( true );
new QAction( "PNG", 0, 0, outputg, 0, true );
@@ -417,17 +417,25 @@ void CameraMainWindow::shutterClicked()
}
void CameraMainWindow::performCapture( const QString& format )
{
QString name;
if ( outputTo == "Documents Folder" )
+ {
name.sprintf( "%s/Documents/image/%s/", (const char*) QDir::homeDirPath(), (const char*) captureFormat.lower() );
+ if ( !QDir( name ).exists() )
+ {
+ odebug << "creating directory " << name << oendl;
+ QString msg = "mkdir -p " + name;
+ system( msg.latin1() );
+ }
+ }
else
name = outputTo;
name.append( prefix );
if ( appendSettings )
{
name.append( QString().sprintf( "_%d_%d_q%d", captureX, captureY, quality ) );
}
@@ -496,34 +504,50 @@ void CameraMainWindow::stopVideoCapture()
killTimers();
//ODevice::inst()->touchSound();
ODevice::inst()->setLedState( Led_Mail, Led_Off );
_capturing = false;
updateCaption();
::close( _capturefd );
_framerate = 1000.0 / (_time.elapsed()/_videopics);
- QString name( outputTo );
- name.append( "/prefix" );
+ QString name;
+ if ( outputTo == "Documents Folder" )
+ {
+ name.sprintf( "%s/Documents/video/%s/", (const char*) QDir::homeDirPath(), (const char*) captureFormat.lower() );
+ if ( !QDir( name ).exists() )
+ {
+ odebug << "creating directory " << name << oendl;
+ QString msg = "mkdir -p " + name;
+ system( msg.latin1() );
+ }
+ }
+ else
+ name = outputTo;
+
+ name.append( "/" ); // sure is sure and safe is safe ;-)
+ name.append( prefix );
if ( appendSettings )
name.append( QString().sprintf( "_%d_%d_q%d_%dfps", captureX, captureY, quality, _framerate ) );
name.append( QString().sprintf( "-%d.%s", _videos++, (const char*) captureFormat.lower() ) );
postProcessVideo( CAPTUREFILE, name );
#ifndef QT_NO_DEBUG
preview->setRefreshingRate( 1500 );
#else
preview->setRefreshingRate( 200 );
#endif
//delete[] _capturebuf; //FIXME: close memory leak
}
void CameraMainWindow::postProcessVideo( const QString& infile, const QString& outfile )
{
+ odebug << "post processing " << infile << " --> " << outfile << oendl;
+
preview->setRefreshingRate( 0 );
/*
unsigned char buf[153600];
int fd = ::open( "/var/compile/opie/noncore/multimedia/camera/capture-320x240.dat", O_RDONLY );
::read( fd, &buf, 153600 );
QImage i;
@@ -591,17 +615,17 @@ void CameraMainWindow::postProcessVideo( const QString& infile, const QString& o
bufferToImage( captureX, captureY, inbuffer, &image );
QPixmap p;
p.convertFromImage( image );
preview->setPixmap( p );
preview->repaint();
qApp->processEvents();
- #ifndef QT_NO_DEBUG
+ #ifdef CAMERA_EXTRA_DEBUG
QString tmpfilename;
tmpfilename.sprintf( "/tmp/test/%04d.jpg", i );
#else
QString tmpfilename( "/tmp/tempfile" );
#endif
imageToFile( &image, tmpfilename, "JPEG", quality );
@@ -616,38 +640,42 @@ void CameraMainWindow::postProcessVideo( const QString& infile, const QString& o
odebug << "filesize for frame " << i << " = " << filesize << oendl;
unsigned char* tempbuffer = new unsigned char[ filesize ];
framefile.readBlock( (char*) tempbuffer, filesize );
avi_add( outfd, tempbuffer, filesize );
delete tempbuffer;
framefile.close();
- odebug << "deleting temporary capturefile " << infile << oendl;
- ::close( infd );
- QFile::remove( infile );
}
avi_end( outfd, captureX, captureY, _framerate );
::close( outfd );
+ ::close( infd );
+
+ label->setText( "deleting temp files..." );
+ qApp->processEvents();
+ odebug << "deleting temporary capturefile " << infile << oendl;
+ QFile::remove( infile );
fr->hide();
delete fr;
updateCaption();
}
void CameraMainWindow::updateCaption()
{
if ( !_capturing )
setCaption( QString().sprintf( "Opie-Camera: %dx%d %s q%d z%d (%s)", captureX, captureY, (const char*) captureFormat.lower(), quality, zoom, (const char*) flip ) );
else
setCaption( "Opie-Camera: => CAPTURING <=" );
+ qApp->processEvents();
}
#ifndef QT_NO_DEBUG
void CameraMainWindow::doSomething()
{
captureX = 240;
captureY = 320;
diff --git a/noncore/multimedia/camera/opie-camera.control b/noncore/multimedia/camera/opie-camera.control
index a33de38..1731ad2 100644
--- a/noncore/multimedia/camera/opie-camera.control
+++ b/noncore/multimedia/camera/opie-camera.control
@@ -1,10 +1,10 @@
Package: opie-camera
Files: bin/opiecam pics/camera apps/Applications/camera.desktop
Priority: optional
Section: opie/applications
Maintainer: Michael 'Mickey' Lauer <mickeyl@handhelds.org>
Architecture: arm
-Version: $QPE_VERSION-$SUB_VERSION
+Version: 1.0
Depends: task-opie-minimal, libopie2 (1.8.1)
Description: A Camera Application
A Camera Application to use with the Sharp CE-AG06.