home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <conio.h>
- #include "mpgmovie.h"
-
- int DelayMiliSecond(long miliseconds)
- {
- int lobyte;
- int hibyte;
-
- miliseconds *= 1000L;
- lobyte = (int)miliseconds;
- hibyte = (int)(miliseconds>>16);
-
- _asm mov dx,lobyte
- _asm mov cx,hibyte
- _asm mov ah,86h
- _asm int 15h
- _asm jc error
- return 1;
- error:
- return 0;
- }
-
- int main(int argc,char *argv[])
- {
- int status = 0;
- int flag = 0;
-
- if (argc < 2)
- {
- printf("Usage: MPEG <mpeg file>\n");
- return 1;
- }
- status = MOVIE_Initialize(-1,-1);
- if (status == 0)
- {
- printf("Fail to detect hardware.\n");
- return 2;
- }
- else if (status == -1)
- {
- printf("Memory insufficient.\n");
- return 2;
- }
-
- if (MOVIE_CDROM_Installed())
- {
- if (MOVIE_CDROM_HasDisc())
- {
- if (MOVIE_CDROM_IsDiscChanged()) printf("Disc is changed.\n");
- }
- }
-
- if (!MOVIE_OpenFile(argv[1]))
- {
- MOVIE_Exit(0);
- printf("Fail to open %s.\n",argv[1]);
- return 3;
- }
-
- MOVIE_VGA_Output(flag);
-
- DelayMiliSecond(1000L);
-
- MOVIE_Play();
- status = 0;
- while (1)
- {
- if (kbhit())
- {
- int ch;
-
- ch = getch();
- if (ch == 0x1B)
- {
- status = 1;
- break;
- }
- else if (ch == ' ')
- {
- flag ^= 1;
- MOVIE_VGA_Output(flag);
- }
-
- }
- if (!MOVIE_SendData()) break;
- if (MOVIE_Error)
- {
- status = 1;
- printf("Decoding error\n");
- break;
- }
- }
- MOVIE_Pause();
- MOVIE_CloseFile();
- MOVIE_Exit(0);
- MOVIE_VGA_Output(1);
- return status;
- }