-rw-r--r-- | noncore/multimedia/camera/avi.c | 3 | ||||
-rw-r--r-- | noncore/multimedia/camera/mainwindow.cpp | 10 |
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 | |||
@@ -111,25 +111,26 @@ void avi_end(int fd, int width, int height, int fps) | |||
111 | write(fd, &idx, sizeof(idx)); | 111 | write(fd, &idx, sizeof(idx)); |
112 | 112 | ||
113 | for ( i = 0; i < nframes; i++ ) | 113 | for ( i = 0; i < nframes; i++ ) |
114 | { | 114 | { |
115 | write(fd, &db, 4 ); // only need the 00db | 115 | write(fd, &db, 4 ); // only need the 00db |
116 | fprint_quartet( fd, 18 ); // ??? | 116 | fprint_quartet( fd, 18 ); // ??? |
117 | fprint_quartet( fd, offset ); | 117 | fprint_quartet( fd, offset ); |
118 | fprint_quartet( fd, sizes[i] ); | 118 | fprint_quartet( fd, sizes[i] ); |
119 | offset += sizes[i]; | 119 | offset += sizes[i] + 8; //+8 (for the additional header) |
120 | } | 120 | } |
121 | 121 | ||
122 | free( sizes ); | 122 | free( sizes ); |
123 | 123 | ||
124 | bzero( &ah, sizeof(ah) ); | 124 | bzero( &ah, sizeof(ah) ); |
125 | strcpy(ah.avih, "avih"); | 125 | strcpy(ah.avih, "avih"); |
126 | ah.time = 1000000 / fps; | 126 | ah.time = 1000000 / fps; |
127 | ah.maxbytespersec = 1000000.0*(totalsize/nframes)/ah.time; | 127 | ah.maxbytespersec = 1000000.0*(totalsize/nframes)/ah.time; |
128 | ah.nframes = nframes; | ||
128 | ah.numstreams = 1; | 129 | ah.numstreams = 1; |
129 | ah.flags = AVIF_HASINDEX; | 130 | ah.flags = AVIF_HASINDEX; |
130 | ah.width = width; | 131 | ah.width = width; |
131 | ah.height = height; | 132 | ah.height = height; |
132 | 133 | ||
133 | bzero(&sh, sizeof(sh)); | 134 | bzero(&sh, sizeof(sh)); |
134 | strcpy(sh.strh, "strh"); | 135 | strcpy(sh.strh, "strh"); |
135 | strcpy(sh.vids, "vids"); | 136 | strcpy(sh.vids, "vids"); |
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 | |||
@@ -491,18 +491,22 @@ void CameraMainWindow::postProcessVideo( const QString& infile, const QString& o | |||
491 | bufferToImage( captureX, captureY, inbuffer, &image ); | 491 | bufferToImage( captureX, captureY, inbuffer, &image ); |
492 | 492 | ||
493 | QPixmap p; | 493 | QPixmap p; |
494 | p.convertFromImage( image ); | 494 | p.convertFromImage( image ); |
495 | preview->setPixmap( p ); | 495 | preview->setPixmap( p ); |
496 | preview->repaint(); | 496 | preview->repaint(); |
497 | qApp->processEvents(); | 497 | qApp->processEvents(); |
498 | 498 | ||
499 | #ifndef QT_NO_DEBUG | ||
500 | QString tmpfilename; | ||
501 | tmpfilename.sprintf( "/tmp/test/%04d.jpg", i ); | ||
502 | #else | ||
499 | QString tmpfilename( "/tmp/tempfile" ); | 503 | QString tmpfilename( "/tmp/tempfile" ); |
500 | //tmpfilename.sprintf( "/tmp/test/%d.jpg", i ); | 504 | #endif |
501 | 505 | ||
502 | imageToFile( &image, tmpfilename, "JPEG", quality ); | 506 | imageToFile( &image, tmpfilename, "JPEG", quality ); |
503 | 507 | ||
504 | QFile framefile( tmpfilename ); | 508 | QFile framefile( tmpfilename ); |
505 | if ( !framefile.open( IO_ReadOnly ) ) | 509 | if ( !framefile.open( IO_ReadOnly ) ) |
506 | { | 510 | { |
507 | oerr << "can't process file: %s" << strerror(errno) << oendl; | 511 | oerr << "can't process file: %s" << strerror(errno) << oendl; |
508 | return; // TODO: clean up temp ressources | 512 | return; // TODO: clean up temp ressources |
@@ -537,15 +541,15 @@ void CameraMainWindow::updateCaption() | |||
537 | } | 541 | } |
538 | 542 | ||
539 | 543 | ||
540 | #ifndef QT_NO_DEBUG | 544 | #ifndef QT_NO_DEBUG |
541 | void CameraMainWindow::doSomething() | 545 | void CameraMainWindow::doSomething() |
542 | { | 546 | { |
543 | captureX = 240; | 547 | captureX = 240; |
544 | captureY = 320; | 548 | captureY = 320; |
545 | _videopics = 176; | 549 | _videopics = 50; |
546 | _framerate = 5; | 550 | _framerate = 5; |
547 | postProcessVideo( "/var/compile/opie/noncore/multimedia/camera/capture-320x240.dat", | 551 | postProcessVideo( "/var/compile/opie/noncore/multimedia/camera/capture.dat", |
548 | "/tmp/output.avi" ); | 552 | "/tmp/output.avi" ); |
549 | } | 553 | } |
550 | #endif | 554 | #endif |
551 | 555 | ||