InputMedia.h
上传用户:lusi_8715
上传日期:2007-01-08
资源大小:199k
文件大小:2k
源码类别:

流媒体/Mpeg4/MP4

开发平台:

Visual C++

  1. /**************************************************************************************
  2.  *                                                                                    *
  3.  * This application contains code from OpenDivX and is released as a "Larger Work"    *
  4.  * under that license. Consistant with that license, this application is released     *
  5.  * under the GNU General Public License.                                              *
  6.  *                                                                                    *
  7.  * The OpenDivX license can be found at: http://www.projectmayo.com/opendivx/docs.php *
  8.  * The GPL can be found at: http://www.gnu.org/copyleft/gpl.html                      *
  9.  *                                                                                    *
  10.  * Copyright (c) 2001 - Project Mayo                                                  *
  11.  *                                                                                    *
  12.  * Authors: Damien Chavarria <adrc at projectmayo.com>                                *
  13.  *                                                                                    *
  14.  **************************************************************************************/
  15. #ifndef INPUT_MEDIA_H
  16. #define INPUT_MEDIA_H
  17. /*
  18.  * Includes
  19.  */
  20. #include <windows.h>
  21. #include <wininet.h>
  22. #include <fcntl.h>
  23. #include <stdio.h>
  24. #include <io.h>
  25. #include <crtdbg.h>
  26. #include <mmsystem.h>
  27. #include "debug.h"
  28. #define HTTP_BUFFER_SIZE 556000
  29. /*
  30.  * Media source enum
  31.  */
  32. enum {
  33. INPUT_TYPE_FILE,
  34. INPUT_TYPE_HTTP,
  35. };
  36. /*
  37.  * File mode enum
  38.  */
  39. enum {
  40. INPUT_OPEN_ASCII,
  41. INPUT_OPEN_BINARY
  42. };
  43. /*
  44.  * Seek Enum
  45.  */
  46. enum {
  47. INPUT_SEEK_SET,
  48. INPUT_SEEK_CUR,
  49. INPUT_SEEK_END
  50. };
  51. /*
  52.  * Input Class
  53.  */
  54. class InputMedia {
  55. public:
  56. DWORD mode;
  57. FILE *file;
  58. FILE *dnld;
  59. char *buffer;
  60. char *filename;
  61. DWORD file_size;
  62. /*
  63.    * HTTP/FTP stuff 
  64.  */
  65. HINTERNET hInternet;
  66. HINTERNET http;
  67. HANDLE    httpThread;
  68. DWORD     httpId;
  69. DWORD     running;
  70. DWORD     buffering;
  71. DWORD     downloaded;
  72. DWORD     eof;
  73. HANDLE    ioMutex;
  74. DWORD     lastReadPos;
  75. InputMedia();
  76. ~InputMedia();
  77. int Open(char *lpFilename, int mode, int type);
  78. int isOK();
  79. char *getFilename();
  80. DWORD getSize();
  81. int getBufferState();
  82. int Read(char *data, unsigned int size);
  83. int Seek(int   size, unsigned int method);
  84. int ScanF(const char *format, void *data);
  85. int Close();
  86. };
  87. #endif