summaryrefslogtreecommitdiff
path: root/noncore/multimedia
Unidiff
Diffstat (limited to 'noncore/multimedia') (more/less context) (ignore 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
@@ -107,33 +107,34 @@ void avi_end(int fd, int width, int height, int fps)
107 printf( "avi_end: nframes = %d, fps = %d\n", nframes, fps ); 107 printf( "avi_end: nframes = %d, fps = %d\n", nframes, fps );
108 108
109 // write index 109 // write index
110 110
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");
136 strcpy(sh.codec, "MJPG"); 137 strcpy(sh.codec, "MJPG");
137 sh.scale = ah.time; 138 sh.scale = ah.time;
138 sh.rate = 1000000; 139 sh.rate = 1000000;
139 sh.length = nframes; 140 sh.length = nframes;
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
@@ -487,26 +487,30 @@ void CameraMainWindow::postProcessVideo( const QString& infile, const QString& o
487 // </gui> 487 // </gui>
488 488
489 int read = ::read( infd, inbuffer, framesize ); 489 int read = ::read( infd, inbuffer, framesize );
490 odebug << "read " << read << " bytes" << oendl; 490 odebug << "read " << read << " bytes" << oendl;
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
509 } 513 }
510 514
511 int filesize = framefile.size(); 515 int filesize = framefile.size();
512 odebug << "filesize for frame " << i << " = " << filesize << oendl; 516 odebug << "filesize for frame " << i << " = " << filesize << oendl;
@@ -533,19 +537,19 @@ void CameraMainWindow::updateCaption()
533 if ( !_capturing ) 537 if ( !_capturing )
534 setCaption( QString().sprintf( "Opie-Camera: %dx%d %s q%d z%d (%s)", captureX, captureY, (const char*) captureFormat.lower(), quality, zoom, (const char*) flip ) ); 538 setCaption( QString().sprintf( "Opie-Camera: %dx%d %s q%d z%d (%s)", captureX, captureY, (const char*) captureFormat.lower(), quality, zoom, (const char*) flip ) );
535 else 539 else
536 setCaption( "Opie-Camera: => CAPTURING <=" ); 540 setCaption( "Opie-Camera: => CAPTURING <=" );
537} 541}
538 542
539 543
540#ifndef QT_NO_DEBUG 544#ifndef QT_NO_DEBUG
541void CameraMainWindow::doSomething() 545void 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