1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
/*creation of bitmap pictures*/
BITMAPINFOHEADER Bih;
ZeroMemory(&Bih, sizeof(BITMAPINFOHEADER));/*restoring*/
Bih.biBitCount = 24; /*3 x 8 bits per pixel*/
Bih.biCompression = BI_RGB;
Bih.biHeight = height;
Bih.biWidth = width;
Bih.biPlanes = 1;
Bih.biSize = sizeof(Bih);
PAVIFILE newavi;
int r;
/*openning and test of the avi file*/
r=AVIFileOpen(&newavi, "test.avi",OF_WRITE | OF_CREATE, NULL);
if(r!=0)
{
if(newavi!=NULL)
AVIFileRelease(newavi);
puts("error in openning avi file");
return ;
}
/*copy of the information*/
AVISTREAMINFO streaminfo;
ZeroMemory(&streaminfo, sizeof(AVISTREAMINFO));/*restoring*/
streaminfo.fccType = streamtypeVIDEO;
streaminfo.fccHandler =0;
streaminfo.dwScale = 1;
streaminfo.dwRate = 30; // à voir combien je vais mettre, le vrai framerate d'acquisition sans doute
streaminfo.dwSuggestedBufferSize =0;
streaminfo.dwQuality =1000;
streaminfo.rcFrame.right =width;
streaminfo.rcFrame.bottom =height;
/*creation of the new stream*/
PAVISTREAM avistream;
r=AVIFileCreateStream(newavi,&avistream, &streaminfo);
if (r!=0)
{
puts("error in the creation of the new stream");
AVIFileRelease (newavi);
AVIFileExit ();
return ;
}
/*format of the stream*/
AVIStreamSetFormat(avistream, 0, &Bih, sizeof(Bih));
if (r!=0)
{
puts("error in the setting of the stream format");
AVIStreamClose(avistream);
AVIFileRelease (newavi);
AVIFileExit ();
return ;
}
/*stream writing */
r = AVIStreamWrite(avistream, 0, nb_images, pSequence, sizeofsequence, AVIIF_KEYFRAME, NULL, NULL);
if(r==0)
AfxMessageBox("OK!");
AVIFileRelease (newavi); |
Partager