Accueil > Forum > > > > Help for change a program in C++ for AVI file
Help for change a program in C++ for AVI file
jeudi 13 novembre 2008 à 07:16:28 |
Help for change a program in C++ for AVI file

mr_log
|
please how to change this program for read all size for AVI file? Ce programme permet d'aficher un fichier AVI bien précis width= 48 and lenght=80, so the size is 48x80x3= 117Ko alors si en change la taille du video il ne peut pas marché, il affiche dans un 1er temps une image bmp inversé, au dessous de cette image il affiche 5 frames, et au dessous il affiche le video, mais just pour cette taille, alors comment faire si je veux changer le program pour lire tout les tailles des fichiers AVI? si quelqu'un peut m'aider je vous remercie vivement. // Get pointers to the info structure & the bits pointer = (BYTE *) prifffile ; the pointer here is static I think we must change into dynamic for read all size //sstring[0] = * (pointer+4095); pointer = pointer + 4096+11; // here we can change the color of bitmap background hdc = BeginPaint (hwnd, &ps) ; //draw a frame for(i=0;i<48;i++) for(j=0;j<80;j++) if((0.299*(*(pointer+2+i*80*3+j*3))+0.587*(*(pointer+1+i*80*3+j*3))+0.114*(*(pointer +i*80*3+j*3)))<100) SetPixel(hdc,j+50,i+50,RGB(255,0,0)); //draw 5 frames parally for(m=0;m<5;m++){// this is a movie for(i=0;i<48;i++) for(j=0;j<80;j++) SetPixel(hdc,j+100*m+50,i+150,RGB(*(pointer+2 + j*3 +(48-i)*80*3), *(pointer+1 + j*3 +(48-i)*80*3), *(pointer + j*3 +(48-i)*80*3))); pointer = pointer + 11520*m+8*m; } pointer = (BYTE *) prifffile ; //let the pointer to pointer the begining again pointer = pointer + 4096+11; //let the pointer to point at the bitmap data //draw several frames to make a animation as movie for(n=0;n<5;n++){ // repeat 5 times for(m=0;m<5;m++){// this is a movie for(i=0;i<48;i++) for(j=0;j<80;j++) SetPixel(hdc,j+50,i+250,RGB(*(pointer+2 + j*3 +(48-i)*80*3), *(pointer+1 + j*3 +(48-i)*80*3), *(pointer + j*3 +(48-i)*80*3))); pointer = pointer + 11520*m+8*m; Sleep(300); // set a time interval to make the movie natural } pointer = (BYTE *) prifffile ; //let the pointer to pointer the begining again pointer = pointer + 4096+11; //let the pointer to point at the bitmap data } // repeat 10 times EndPaint (hwnd, &ps) ; // show a dialogbox to tell you that the testing ends MessageBox(hwnd,TEXT("displaying ends/ÑÝÊ??áÊø"),sstring,0); return 0 ; ================================================================================================================================================ ||Program|| ------- /*---------------------------------------------- SHOWDIB1.C -- Shows a DIB in the client area (c) Charles Petzold, 1998 ----------------------------------------------*/ #include #include #include #include "dibfile.h" #include "resource.h" LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ; TCHAR szAppName[] = TEXT ("ShowDib1") ; int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR szCmdLine, int iCmdShow) { HACCEL hAccel ; HWND hwnd ; MSG msg ; WNDCLASS wndclass ; wndclass.style = CS_HREDRAW | CS_VREDRAW ; wndclass.lpfnWndProc = WndProc ; wndclass.cbClsExtra = 0 ; wndclass.cbWndExtra = 0 ; wndclass.hInstance = hInstance ; wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ; wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ; wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ; wndclass.lpszMenuName = szAppName ; wndclass.lpszClassName = szAppName ; if (!RegisterClass (&wndclass)) { MessageBox (NULL, TEXT ("This program requires Windows NT!"), szAppName, MB_ICONERROR) ; return 0 ; } hwnd = CreateWindow (szAppName, TEXT ("display an avi picture and an avi movie"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL) ; ShowWindow (hwnd, iCmdShow) ; UpdateWindow (hwnd) ; hAccel = LoadAccelerators (hInstance, szAppName) ; while (GetMessage (&msg, NULL, 0, 0)) { if (!TranslateAccelerator (hwnd, hAccel, &msg)) { TranslateMessage (&msg) ; DispatchMessage (&msg) ; } } return msg.wParam ; } LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { //////////////////////////////////// static BITMAPINFO * pbmi ; static BYTE * pBits ; //////////////////////////////////// static RIFFLIST * prifffile ; static AVIMAINHEADER * pavimh; static AVISTREAMHEADER * pavish ; static BYTE * pointer ; ///////////////////////////////////////////////////////////////////// static int cxClient, cyClient, cxDib, cyDib ; static TCHAR szFileName [MAX_PATH], szTitleName [MAX_PATH] ; BOOL bSuccess ; HDC hdc ; PAINTSTRUCT ps ; int i,j,m,n; ////////////////////////////////////////////////////////////////////// // RIFF is the first 4 letters of a riff file. avi file is a riff file static TCHAR sstring[] = {'R','I','F','F','\0'}; ////////////////////////////////////////////////////////////////////// switch (message) { case WM_CREATE: DibFileInitialize (hwnd) ; return 0 ; case WM_SIZE: cxClient = LOWORD (lParam) ; cyClient = HIWORD (lParam) ; return 0 ; case WM_INITMENUPOPUP: EnableMenuItem ((HMENU) wParam, IDM_FILE_SAVE, prifffile ? MF_ENABLED : MF_GRAYED) ; return 0 ; case WM_COMMAND: switch (LOWORD (wParam)) { case IDM_FILE_OPEN: // Show the File Open dialog box if (!DibFileOpenDlg (hwnd, szFileName, szTitleName)) return 0 ; // If there's an existing DIB, free the memory MessageBox(hwnd,szFileName,TEXT("The name of the file you have opened is"),0); if (prifffile) { free (prifffile) ; prifffile = NULL ; } // Load the entire DIB into memory SetCursor (LoadCursor (NULL, IDC_WAIT)) ; ShowCursor (TRUE) ; prifffile = DibLoadImage(szFileName) ; ShowCursor (FALSE) ; SetCursor (LoadCursor (NULL, IDC_ARROW)) ; // Invalidate the client area for later update InvalidateRect (hwnd, NULL, TRUE) ; if (prifffile == NULL) { MessageBox (hwnd, TEXT ("Cannot load AVI file"), szAppName, 0) ; return 0 ; } /* ------------------------------------------------------------------------------ */ // Get pointers to the info structure & the bits pointer = (BYTE *) prifffile ; //sstring[0] = * (pointer+4095); pointer = pointer + 4096; // here we can change the color of bitmap background hdc = BeginPaint (hwnd, &ps) ; //draw a frame //»Ò»Ö¡ for(i=0;i<48;i++) for(j=0;j<80;j++) if((0.299*(*(pointer+2+i*80*3+j*3))+0.587*(*(pointer+1+i*80*3+j*3))+0.114*(*(pointer +i*80*3+j*3)))<100) SetPixel(hdc,j+50,i+50,RGB(255,0,0)); //draw 5 frames parally for(m=0;m<5;m++){// this is a movie for(i=0;i<48;i++) //»Ò»Ö¡ for(j=0;j<80;j++) SetPixel(hdc,j+100*m+50,i+150,RGB(*(pointer+2 + j*3 +(48-i)*80*3), *(pointer+1 + j*3 +(48-i)*80*3), *(pointer + j*3 +(48-i)*80*3))); pointer = pointer + 11520*m+8*m; } pointer = (BYTE *) prifffile ; //let the pointer to pointer the begining again pointer = pointer + 4096+11; //let the pointer to point at the bitmap data //draw several frames to make a animation as movie for(n=0;n<5;n++){ // repeat 10 times for(m=0;m<5;m++){// this is a movie for(i=0;i<48;i++) for(j=0;j<80;j++) SetPixel(hdc,j+50,i+250,RGB(*(pointer+2 + j*3 +(48-i)*80*3), *(pointer+1 + j*3 +(48-i)*80*3), *(pointer + j*3 +(48-i)*80*3))); pointer = pointer + 11520*m+8*m; Sleep(300); // set a time interval to make the movie natural } pointer = (BYTE *) prifffile ; //let the pointer to pointer the begining again pointer = pointer + 4096+11; //let the pointer to point at the bitmap data } // repeat 10 times EndPaint (hwnd, &ps) ; // show a dialogbox to tell you that the testing ends MessageBox(hwnd,TEXT("displaying ends/ÑÝÊ??áÊø"),sstring,0); return 0 ; case IDM_FILE_SAVE: // Show the File Save dialog box if (!DibFileSaveDlg (hwnd, szFileName, szTitleName)) return 0 ; // Save the DIB to memory SetCursor (LoadCursor (NULL, IDC_WAIT)) ; ShowCursor (TRUE) ; bSuccess = DibSaveImage (szFileName, prifffile) ; ShowCursor (FALSE) ; SetCursor (LoadCursor (NULL, IDC_ARROW)) ; if (!bSuccess) MessageBox (hwnd, TEXT ("Cannot save AVI file"), szAppName, 0) ; return 0 ; } break ; case WM_PAINT: hdc = BeginPaint (hwnd, &ps) ; /*if (pbmi) SetDIBitsToDevice (hdc, 50, // xDst 100, // yDst cxDib, // cxSrc cyDib, // cySrc 0, // xSrc 0, // ySrc 0, // first scan line cyDib, // number of scan lines pBits, pbmi, DIB_RGB_COLORS) ; */ EndPaint (hwnd, &ps) ; return 0 ; case WM_DESTROY: /*if (pointer) free (pointer); if (prifffile) free (prifffile); if (pavish) free (pavish); if (pbmi) free (pbmi) ; if (pavimh) free (pavimh) ; if(pBits) free (pBits); */ PostQuitMessage (0) ; return 0 ; } return DefWindowProc (hwnd, message, wParam, lParam) ; }
|
|
Cette discussion est classée dans : file, hwnd, for, pointer, wndclass
Répondre à ce message
Sujets en rapport avec ce message
WSAAsyncselect pour client TCP [ par daviid00 ]
Bonjour, Je suis entrain de développer un client TCP qui se connecte de manière asynchrone à un serveur. Pour ce faire j'utilise la fonction WSAAsync
Problème avec GetOpenFileName() [ par max12 ]
Salut,J'ai un problème avec la fonction GetOpenFileName()BOOL CALLBACK ExplorerDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){ HWND
Affichage avec API Windows [ par PunkDude424 ]
Bon j'ai un problème avec l'affichage à l'aide de L'api win32Je suis débutant en la matière et j'ai le problème suivant.J'ai une application client se
Edit Control [ par cybermatthieu ]
Bonjours,Je suis en Train d'apprendre comment progrmmer en Win32 avec la Class Windows.h. Ce petit programme ne fait q'afficher des caracter mais j'ai
erreur(vc++6) [ par greg4 ]
Linking...LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _mainDebug/fen.exe : fatal error LNK1120: 1 unresolved externalsError execut
Savoir quand on clique sur un bouton [ par cyberlewis ]
Slt à tous, Voilà j'ai un code que j'ai fait, et normalement si on cliques sur les boutons, ça lance la fonction Encode() ou Decode() en fonction du b
bmp dans static [ par Arnaud16022 ]
bonjourvoila je veux mettre un bmp dans un static.dans le fichier rc ya:SniperImg BITMAP "C:/sniper.bmp"et dans le main ya (en simplifie)#include LRES
File mapping [ par deck_bsd ]
Bonsoir / Bonjour à tous,Voila j'ai trouvé l'exelente source de BruNews concernant les instance unique de programme. Plutot que de recopier bêtement l
keyboard [ par ToToL ]
J'ai créé un programme sauf que mon probleme est la vitesse de repetition des touche que je voudrai faire instantanné car sinon j'ai il y a un "blanc"
Livres en rapport
|
Derniers Blogs
JOYEUX ANNIVERSAIRE NIXJOYEUX ANNIVERSAIRE NIX par ebartsoft
Souhaitons un bon et joyeux anniversaire à notre hôte à tous, Nix.
Je ne le répéterais jamais assez mais sans lui rien ne serait possible. Il défit en permanence les lois de la gravité et comme il le dit si bien, si tu lui fais confiance ça devra...
Cliquez pour lire la suite de l'article par ebartsoft IMAGINE CUP 2012, MAKE A SIGN EN FINALEIMAGINE CUP 2012, MAKE A SIGN EN FINALE par junarnoalg
Voilà qui est fait, la nouvelle est officielle ! L'équipe belge "Make a Sign" va au pays des kangourous défendre son projet dans la catégorie Software Design. http://www.imaginecup.com/CompetitionsContent/Competition/WorldwideFinalists.aspx V...
Cliquez pour lire la suite de l'article par junarnoalg KINECT 1.5 IS OUT !KINECT 1.5 IS OUT ! par Vko
La version 1.5 du Kinect For Microsoft vient tout juste de sortir ! Plein de nouveautés: Tracking de squelette en Near Mode Détection en position assise Détection faciale avec un SDK dédié Documentation et des guideline (enfin) Un out...
Cliquez pour lire la suite de l'article par Vko LES ACTUALITéS DE LA SEMAINE SUR C2I.FR (14 MAI - 20 MAI) LES ACTUALITéS DE LA SEMAINE SUR C2I.FR (14 MAI - 20 MAI) par richardc
Mise à jour des Web API du 14 Mai
Réservez dès maintenant votre journée du 20 juin pour le Windows Azure Dev Camp 2012 à Paris
Mise à jour de Team Foundation Service
MechCommander 2 sur Windows 8
Entity Framework 5 Release Candidate e...
Cliquez pour lire la suite de l'article par richardc REACTIVE EXTENSIONS : CONSOMMER DES SERVICES AVEC RX PARTIE 3, LES PIèGES à éVITERREACTIVE EXTENSIONS : CONSOMMER DES SERVICES AVEC RX PARTIE 3, LES PIèGES à éVITER par Groc
Une mauvaise utilisation de rx lors de l'écriture d'une couche d'accès à des services peut conduire à des cas embarassants avec des erreurs mal gérées, des appels qui ne partent lorsqu'ils le devraient, et même des résultats incorrects . le tout nuis...
Cliquez pour lire la suite de l'article par Groc
Logiciels
sDEVIS-FACTURES vlPRO (8.1.0.3)SDEVIS-FACTURES VLPRO (8.1.0.3)sDEVIS-FACTURES vlPRO a été mis au point pour les particuliers, créateurs, entrepreneurs, artisa... Cliquez pour télécharger sDEVIS-FACTURES vlPRO 974 Application Server (12.2.4.6)974 APPLICATION SERVER (12.2.4.6)Développez de puissantes applications dans un environnement de 'cloud computing', clusterisé, séc... Cliquez pour télécharger 974 Application Server vPicture (1.4.2.1)VPICTURE (1.4.2.1)Avec vPicture, hébergez vos images facilement et rapidement.
vPicture est un utilitaire simple, ... Cliquez pour télécharger vPicture Easy-Planning (2.2.1.6)EASY-PLANNING (2.2.1.6)Easy-Planning permet de créer des plannings sous la représentation de diagrammes et est adapté au... Cliquez pour télécharger Easy-Planning COM-BACKUP (2.0)COM-BACKUP (2.0)
COM-BACKUP est un logiciel de sauvegarde qui permet de planifier les sauvegardes de vos dossiers ...
Cliquez pour télécharger COM-BACKUP
|