home *** CD-ROM | disk | FTP | other *** search
/ Computer Installation Guide - Dragon Clan Series / CD1.iso / MPEG / WFSMP11 / SDK / DOS / MPEG.C < prev    next >
Encoding:
C/C++ Source or Header  |  1995-04-06  |  1.9 KB  |  100 lines

  1. #include <stdio.h>
  2. #include <conio.h>
  3. #include "mpgmovie.h"
  4.  
  5. int DelayMiliSecond(long miliseconds)
  6. {
  7.     int   lobyte;
  8.     int   hibyte;
  9.  
  10.     miliseconds *= 1000L;
  11.     lobyte = (int)miliseconds;
  12.     hibyte = (int)(miliseconds>>16);
  13.  
  14.     _asm    mov    dx,lobyte
  15.     _asm    mov    cx,hibyte
  16.     _asm    mov    ah,86h
  17.     _asm    int    15h
  18.     _asm    jc     error
  19.     return 1;
  20. error:
  21.     return 0;
  22. }
  23.  
  24. int main(int argc,char *argv[])
  25. {
  26.     int status = 0;
  27.     int flag = 0;
  28.  
  29.     if (argc < 2)
  30.     {
  31.         printf("Usage: MPEG <mpeg file>\n");
  32.         return 1;
  33.     }
  34.     status = MOVIE_Initialize(-1,-1);
  35.     if (status == 0)
  36.     {
  37.         printf("Fail to detect hardware.\n");
  38.         return 2;
  39.     }
  40.     else if (status == -1)
  41.     {
  42.         printf("Memory insufficient.\n");
  43.         return 2;
  44.     }
  45.  
  46.     if (MOVIE_CDROM_Installed())
  47.     {
  48.         if (MOVIE_CDROM_HasDisc())
  49.         {
  50.             if (MOVIE_CDROM_IsDiscChanged()) printf("Disc is changed.\n");
  51.         }
  52.     }
  53.  
  54.     if (!MOVIE_OpenFile(argv[1]))
  55.     {
  56.         MOVIE_Exit(0);
  57.         printf("Fail to open %s.\n",argv[1]);
  58.         return 3;
  59.     }
  60.  
  61.     MOVIE_VGA_Output(flag);
  62.  
  63.     DelayMiliSecond(1000L);
  64.  
  65.     MOVIE_Play();
  66.     status = 0;
  67.     while (1)
  68.     {
  69.         if (kbhit())
  70.         {
  71.             int ch;
  72.  
  73.             ch = getch();
  74.             if (ch == 0x1B)
  75.             {
  76.                 status = 1;
  77.                 break;
  78.             }
  79.             else if (ch == ' ')
  80.             {
  81.                 flag ^= 1;
  82.                 MOVIE_VGA_Output(flag);
  83.             }
  84.  
  85.         }
  86.         if (!MOVIE_SendData()) break;
  87.         if (MOVIE_Error)
  88.         {
  89.             status = 1;
  90.             printf("Decoding error\n");
  91.             break;
  92.         }
  93.     }
  94.     MOVIE_Pause();
  95.     MOVIE_CloseFile();
  96.     MOVIE_Exit(0);
  97.     MOVIE_VGA_Output(1);
  98.     return status;
  99. }
  100.