begin process at 2012 05 29 08:44:27
  Trouver un code source :
 
dans
 
Accueil > Forum > 

C++ & C++ .NET

 > 

Algorithme

 > 

Maths

 > 

Help for change a program in C++ for AVI file


Derniers messages déposésPoser une question dans le forum ou lancer une discussion

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"


Nos sponsors


Sondage...

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

Photothèque

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), Merci à Vincent pour ses précieux conseils.
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,562 sec (3)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales