summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/camera/avi.c3
-rw-r--r--noncore/multimedia/camera/mainwindow.cpp10
2 files changed, 9 insertions, 4 deletions
diff --git a/noncore/multimedia/camera/avi.c b/noncore/multimedia/camera/avi.c
index 0c757c9..77aba33 100644
--- a/noncore/multimedia/camera/avi.c
+++ b/noncore/multimedia/camera/avi.c
@@ -103,41 +103,42 @@ void avi_end(int fd, int width, int height, int fps)
struct list_head lh4 = {"LIST", 0, "movi"};
int i;
unsigned int offset = 4;
printf( "avi_end: nframes = %d, fps = %d\n", nframes, fps );
// write index
write(fd, &idx, sizeof(idx));
for ( i = 0; i < nframes; i++ )
{
write(fd, &db, 4 ); // only need the 00db
fprint_quartet( fd, 18 ); // ???
fprint_quartet( fd, offset );
fprint_quartet( fd, sizes[i] );
- offset += sizes[i];
+ offset += sizes[i] + 8; //+8 (for the additional header)
}
free( sizes );
bzero( &ah, sizeof(ah) );
strcpy(ah.avih, "avih");
ah.time = 1000000 / fps;
ah.maxbytespersec = 1000000.0*(totalsize/nframes)/ah.time;
+ ah.nframes = nframes;
ah.numstreams = 1;
ah.flags = AVIF_HASINDEX;
ah.width = width;
ah.height = height;
bzero(&sh, sizeof(sh));
strcpy(sh.strh, "strh");
strcpy(sh.vids, "vids");
strcpy(sh.codec, "MJPG");
sh.scale = ah.time;
sh.rate = 1000000;
sh.length = nframes;
bzero(&fh, sizeof(fh));
strcpy(fh.strf, "strf");
fh.width = width;
diff --git a/noncore/multimedia/camera/mainwindow.cpp b/noncore/multimedia/camera/mainwindow.cpp
index e27a50e..7e60e16 100644
--- a/noncore/multimedia/camera/mainwindow.cpp
+++ b/noncore/multimedia/camera/mainwindow.cpp
@@ -483,34 +483,38 @@ void CameraMainWindow::postProcessVideo( const QString& infile, const QString& o
label->setText( QString().sprintf( "Post processing frame %d / %d", i+1, _videopics ) );
bar->setProgress( i );
bar->repaint();
qApp->processEvents();
// </gui>
int read = ::read( infd, inbuffer, framesize );
odebug << "read " << read << " bytes" << oendl;
bufferToImage( captureX, captureY, inbuffer, &image );
QPixmap p;
p.convertFromImage( image );
preview->setPixmap( p );
preview->repaint();
qApp->processEvents();
+ #ifndef QT_NO_DEBUG
+ QString tmpfilename;
+ tmpfilename.sprintf( "/tmp/test/%04d.jpg", i );
+ #else
QString tmpfilename( "/tmp/tempfile" );
- //tmpfilename.sprintf( "/tmp/test/%d.jpg", i );
+ #endif
imageToFile( &image, tmpfilename, "JPEG", quality );
QFile framefile( tmpfilename );
if ( !framefile.open( IO_ReadOnly ) )
{
oerr << "can't process file: %s" << strerror(errno) << oendl;
return; // TODO: clean up temp ressources
}
int filesize = framefile.size();
odebug << "filesize for frame " << i << " = " << filesize << oendl;
unsigned char* tempbuffer = new unsigned char[ filesize ];
framefile.readBlock( (char*) tempbuffer, filesize );
avi_add( outfd, tempbuffer, filesize );
@@ -529,23 +533,23 @@ void CameraMainWindow::postProcessVideo( const QString& infile, const QString& o
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 <=" );
}
#ifndef QT_NO_DEBUG
void CameraMainWindow::doSomething()
{
captureX = 240;
captureY = 320;
- _videopics = 176;
+ _videopics = 50;
_framerate = 5;
- postProcessVideo( "/var/compile/opie/noncore/multimedia/camera/capture-320x240.dat",
+ postProcessVideo( "/var/compile/opie/noncore/multimedia/camera/capture.dat",
"/tmp/output.avi" );
}
#endif