Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
2519 connectés 

 


Dernière réponse
Sujet : Movie player en c++ Help.
HelloWorld Y'a la classe ANIMATE_CLASS en win32 mais bon t'as pas le son ... et c'est vraiment le truc de base.
Apres y'a aussi les truc mmedia.
Tiens, copier coller du code donné en exemple (mmedia.hlp)
 

Code :
  1. The following example shows how to use the MCI_OPEN command to set a parent window and create a child of that window.
  2. MCI_DGV_OPEN_PARMS    mciOpen; 
  3. mciOpen.lpstrElementName = lpstrFile;  // Set the filename.
  4. mciOpen.dwStyle = WS_CHILD;            // Set the style.  
  5. mciOpen.hWndParent = hWnd;             // Give a window handle.  
  6. if (mciSendCommand(0, MCI_OPEN,
  7.    (DWORD)(MCI_OPEN_ELEMENT|MCI_DGV_OPEN_PARENT|MCI_DGV_OPEN),
  8.    (DWORD)(LPSTR)&mciOpen) == 0)
  9. {
  10.     // Open operation is successful. Continue.  
  11. }
  12. The following example finds the dimensions needed to play an AVI file, creates a window corresponding to that size, and plays the file in the window by using the MCIAVI driver.
  13. HWND hwnd; 
  14. MCI_DGV_RECT_PARMS mciRect;
  15. // Get the movie dimensions with MCI_WHERE.  
  16. mciSendCommand(wDeviceID, MCI_WHERE, MCI_DGV_WHERE_SOURCE,
  17.     (DWORD)(LPSTR)&mciRect);
  18. // Create the playback window. Make it bigger for the border.  
  19. // Note that the right and bottom members of RECT structures in MCI  
  20. // are unusual; rc.right is set to the rectangle's width, and  
  21. // rc.bottom is set to the rectangle's height.
  22. hwndMovie = CreateWindow("mywindow", "Playback",
  23.     WS_CHILD|WS_BORDER, 0,0,
  24.     mciRect.rc.right+(2*GetSystemMetric(SM_CXBORDER)),
  25.     mciRect.rc.bottom+(2*GetSystemMetric(SM_CYBORDER)),
  26.     hwndParent, hInstApp, NULL);
  27. if (hwndMovie){
  28.     // Window created OK; make it the playback window.  
  29.     MCI_DGV_WINDOW_PARMS mciWindow;
  30.     mciWindow.hWnd = hwndMovie;
  31.     mciSendCommand(wDeviceID, MCI_WINDOW, MCI_DGV_WINDOW_HWND,
  32.         (DWORD)(LPSTR)&mciWindow);
  33. }
  34. Before using the mciSendCommand function to send the MCI_PLAY command, your application allocates the memory for the structure, initializes the members it will use, and sets the flags corresponding to the members used in the structure. (If your application does not set a flag for a structure member, MCI drivers ignore the member.) For example, the following example plays a movie from the starting position specified by dwFrom to the ending position specified by dwTo. (If either position is zero, the example is written so that the position is not used.)
  35. DWORD PlayMovie(WORD wDevID, DWORD dwFrom, DWORD dwTo) 
  36. {
  37.     MCI_DGV_PLAY_PARMS mciPlay;    // play parameters  
  38.     DWORD dwFlags = 0;
  39.     // Check dwFrom. If it is != 0 then set parameters and flags.  
  40.     if (dwFrom){
  41.         mciPlay.dwFrom = dwFrom; // set parameter  
  42.         dwFlags |= MCI_FROM;     // set flag to validate member  
  43.     }
  44.     // Check dwTo. If it is != 0 then set parameters and flags.  
  45.     if (dwTo){
  46.         mciPlay.dwTo = dwTo;    // set parameter  
  47.         dwFlags |= MCI_TO;      // set flag to validate member  
  48.     }
  49.     // Send the MCI_PLAY command and return the result.  
  50.     return mciSendCommand(wDevID, MCI_PLAY, dwFlags,
  51.        (DWORD)(LPVOID)&mciPlay);
  52. }


 
Ca semble bien plus complet ...
la suite sur www.google.com


Votre réponse
Nom d'utilisateur    Pour poster, vous devez être inscrit sur ce forum .... si ce n'est pas le cas, cliquez ici !
Le ton de votre message                        
                       
Votre réponse


[b][i][u][strike][spoiler][fixed][cpp][url][email][img][*]   
 
   [quote]
 

Options

 
Vous avez perdu votre mot de passe ?


Vue Rapide de la discussion
HelloWorld Y'a la classe ANIMATE_CLASS en win32 mais bon t'as pas le son ... et c'est vraiment le truc de base.
Apres y'a aussi les truc mmedia.
Tiens, copier coller du code donné en exemple (mmedia.hlp)
 

Code :
  1. The following example shows how to use the MCI_OPEN command to set a parent window and create a child of that window.
  2. MCI_DGV_OPEN_PARMS    mciOpen; 
  3. mciOpen.lpstrElementName = lpstrFile;  // Set the filename.
  4. mciOpen.dwStyle = WS_CHILD;            // Set the style.  
  5. mciOpen.hWndParent = hWnd;             // Give a window handle.  
  6. if (mciSendCommand(0, MCI_OPEN,
  7.    (DWORD)(MCI_OPEN_ELEMENT|MCI_DGV_OPEN_PARENT|MCI_DGV_OPEN),
  8.    (DWORD)(LPSTR)&mciOpen) == 0)
  9. {
  10.     // Open operation is successful. Continue.  
  11. }
  12. The following example finds the dimensions needed to play an AVI file, creates a window corresponding to that size, and plays the file in the window by using the MCIAVI driver.
  13. HWND hwnd; 
  14. MCI_DGV_RECT_PARMS mciRect;
  15. // Get the movie dimensions with MCI_WHERE.  
  16. mciSendCommand(wDeviceID, MCI_WHERE, MCI_DGV_WHERE_SOURCE,
  17.     (DWORD)(LPSTR)&mciRect);
  18. // Create the playback window. Make it bigger for the border.  
  19. // Note that the right and bottom members of RECT structures in MCI  
  20. // are unusual; rc.right is set to the rectangle's width, and  
  21. // rc.bottom is set to the rectangle's height.
  22. hwndMovie = CreateWindow("mywindow", "Playback",
  23.     WS_CHILD|WS_BORDER, 0,0,
  24.     mciRect.rc.right+(2*GetSystemMetric(SM_CXBORDER)),
  25.     mciRect.rc.bottom+(2*GetSystemMetric(SM_CYBORDER)),
  26.     hwndParent, hInstApp, NULL);
  27. if (hwndMovie){
  28.     // Window created OK; make it the playback window.  
  29.     MCI_DGV_WINDOW_PARMS mciWindow;
  30.     mciWindow.hWnd = hwndMovie;
  31.     mciSendCommand(wDeviceID, MCI_WINDOW, MCI_DGV_WINDOW_HWND,
  32.         (DWORD)(LPSTR)&mciWindow);
  33. }
  34. Before using the mciSendCommand function to send the MCI_PLAY command, your application allocates the memory for the structure, initializes the members it will use, and sets the flags corresponding to the members used in the structure. (If your application does not set a flag for a structure member, MCI drivers ignore the member.) For example, the following example plays a movie from the starting position specified by dwFrom to the ending position specified by dwTo. (If either position is zero, the example is written so that the position is not used.)
  35. DWORD PlayMovie(WORD wDevID, DWORD dwFrom, DWORD dwTo) 
  36. {
  37.     MCI_DGV_PLAY_PARMS mciPlay;    // play parameters  
  38.     DWORD dwFlags = 0;
  39.     // Check dwFrom. If it is != 0 then set parameters and flags.  
  40.     if (dwFrom){
  41.         mciPlay.dwFrom = dwFrom; // set parameter  
  42.         dwFlags |= MCI_FROM;     // set flag to validate member  
  43.     }
  44.     // Check dwTo. If it is != 0 then set parameters and flags.  
  45.     if (dwTo){
  46.         mciPlay.dwTo = dwTo;    // set parameter  
  47.         dwFlags |= MCI_TO;      // set flag to validate member  
  48.     }
  49.     // Send the MCI_PLAY command and return the result.  
  50.     return mciSendCommand(wDevID, MCI_PLAY, dwFlags,
  51.        (DWORD)(LPVOID)&mciPlay);
  52. }


 
Ca semble bien plus complet ...
la suite sur www.google.com

LetoII msdn.microsoft.com :D
 
www.google.fr
 
Désolé, pas un grand connaisseur en tutoriel :)
(tante www.developpez.com)
xinoef D'accord, merci pour ces premiers conseil, maintenant je vais jouer le lourd : 1 c'est koi les mfc ?
2 Z'auriez pas qulques petits liens sympatoches pour trouver des tutoriels adaptés ?
Merci :jap:
youdontcare

letoII a écrit a écrit :

Si non tu peux aussi passer par le controle activex du windows media player mais ça me parait moins aproprié


ça me paraît au contraire plus approprié. s'il utilise les mfc, ça se rajoute en qq minutes.

H4dd3R Cherche ds les tutoriaux de dshow pour la décompression de la vidéo (avi file, recompressing an.. et links par la suite).
Par contre pour faire du plein écran je sais pas trop si c possible simplement avec dshow, ou si tu vas devoir définir une surface ddraw.. :)
LetoII Si non tu peux aussi passer par le controle activex du windows media player mais ça me parait moins aproprié
LetoII Faut que tu passe par direct x alors. Jette un coup d'oeuil dans la doc normalement c prévu tu peux jouer des avi directement dans une surface direct draw (enfin me semble ça fait longtemps que j'ai pas fourré mon nez là dedans :D )
xinoef Ben je veux mettre ma video en plein écran. Une intro quoi, comme dans quake, ou unreal , avec des images et du son...
LetoII Tu veux l'afficher comment exactement?
xinoef Bonjour, je souhaiterai mettre dans un programme une vidéo d'intro, donc pouvoir lire un fichier video au démarage.
Quel est d'après vous le moyen le plus facile d'y arriver ?
Merci.

Copyright © 1997-2025 Groupe LDLC (Signaler un contenu illicite / Données personnelles)