home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2004 March / PCWELT_3_2004.ISO / pcwsoft / flaskmpeg_078_39_src.z.exe / flaskmpeg / mismapi.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-10-28  |  6.2 KB  |  148 lines

  1. /* 
  2.  *  FlasKMPEG Mpeg Input Stream Module API 1.0
  3.  *  
  4.  *  This API defines a module to input mpeg streams to FlasKMPEG.
  5.  *
  6.  *    Copyright (C) Alberto Vigata - December 2000  ultraflask@yahoo.com
  7.  *    
  8.  *  This file is part of FlasKMPEG, a free MPEG to MPEG/AVI converter
  9.  *    
  10.  *  FlasKMPEG is free software; you can redistribute it and/or modify
  11.  *  it under the terms of the GNU General Public License as published by
  12.  *  the Free Software Foundation; either version 2, or (at your option)
  13.  *  any later version.
  14.  *   
  15.  *  FlasKMPEG is distributed in the hope that it will be useful,
  16.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.  *  GNU General Public License for more details.
  19.  *   
  20.  *  You should have received a copy of the GNU General Public License
  21.  *  along with GNU Make; see the file COPYING.  If not, write to
  22.  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. 
  23.  *
  24.  */
  25.  
  26. /*   This file defines MISM for FlasKMPEG where MISM stands for Mpeg Input Stream Module.
  27.    The definition of this module is an attempt to standarize all kinds of MPEG sources
  28.    to FlasKMPEG. That includes for example Transport Streams, Program Streams, 
  29.    System Streams, Elementary Streams ...
  30.      Version 1.0 of this API only accepts Program Streams as a valid output. That means that
  31.    any source must be converted to a valid MPEG1 or MPEG2 program stream to be able to 
  32.    feed the stream to FlasKMPEG. Future versions will support elementary streams as well as PES
  33.    streams. 
  34.      MISM modules must be reentrant.
  35. */
  36.  
  37. #ifndef MISMAPI_H
  38. #define MISMAPI_H
  39.  
  40. #include "flasktypes.h"
  41.  
  42. #define    FM_MISM_VERSION        0x00000110
  43. #define    FM_MISM_OK              0x00000004
  44. #define    FM_MISM_ERROR            0x00000005
  45.  
  46. // Features flags
  47. #define    FM_MISM_READFILES      0x00000001 // The input source of this module are files
  48.  
  49. // Output stream types
  50. #define FM_MISM_PROGRAMSTREAM   0X00000001  // Only this type is supported as version 1.0 of MISM
  51. #define FM_MISM_TRANSPORTSTREAM 0X00000002
  52. #define FM_MISM_AUDIOES         0X00000004
  53. #define FM_MISM_VIDEOES         0X00000008
  54.  
  55. #define FM_MISM_MERIT_DONOTUSE  0
  56. #define FM_MISM_MERIT_NORMAL    FM_MISM_MERIT_DONOTUSE + 5 
  57.  
  58. struct fmStreamId
  59. {
  60.   BYTE    streamId;   // Main stream id of an mpeg stream
  61.   BYTE subStreamId;   // substream id for mpeg private streams
  62.   char  streamName[256]; // Identifier name for this stream
  63. };
  64.  
  65. #define FM_MISM_MAXSTREAMS 64
  66. struct fmStreamIds
  67. {
  68.   fmStreamId vIds[FM_MISM_MAXSTREAMS];  // vector of stream ids that we are interested
  69.   int       idAudioDef; // index of the default audio track
  70.   int       idCount;    // number of ids contained inside vIds. Up to 16.
  71. };
  72.  
  73. typedef struct
  74. {
  75.   char *(* GetString)(int x); // FlasK localization strings
  76.   int  lurkSize;    // This parameter can be used as a guide to know how many bytes
  77.                     //   the module can seek from the beginning of the file in search of streams.
  78.   HWND      hWnd;
  79.   HINSTANCE hInst;
  80.   
  81. } FMMismStdParms,*LPFMMismStdParms;
  82.  
  83. typedef struct tagMismProperties
  84. {
  85.   DWORD dwSize;   // Size of this structure
  86.   DWORD dwMismId; // Identifier for this Mism
  87. } FMMismProperties, *LPFMMismProperties;
  88.  
  89. typedef long fmHandle;
  90.  
  91. typedef    struct {
  92.   // basic information
  93.   DWORD    dwSize;                  // Size of this structure
  94.   DWORD dwVersion;          // Must be FM_MISM_VERSION
  95.   DWORD dwOutputTypes;      // Output types that this modules can output. Must 
  96.                             //  support FM_MISM_PROGRAMSTREAM for version 1.0 of MISM
  97.   DWORD dwReserved;         // Not used as MISM 1.0. Set it to 0.
  98.   LPFMMismProperties pProperties; // Properties of this Mism.
  99.   char  sDescription[256];  // Description of the module. Brief explanation of what this module does.
  100.   char  sExtensions[256];   // a list of file patterns (*.vob;*.ifo) sep. by ; For example
  101.                             // if your module accepts program streams as input one valid string could be:
  102.                             // *.m2v;*.mpg;*.vob;*.m1v;*.m2v;*.mpe;*.mpeg;*.mv2;*.mpv
  103.                             // Note: the file extensions defined here don't preclude the opening of the stream
  104.                             //       See CanOpenFile() below.
  105.   // File IO ptrs
  106.   bool (*CanOpenFile)(char *file, DWORD *merit); // A file path is passed through file. If the module has
  107.                                    //   the ability to parse that file it return true.
  108.  
  109.   fmHandle (*OpenStream)(char *file); 
  110.   // Returns a handle to the opened stream, if failure returns NULL.
  111.   //  Call GetError() to get a description of the error
  112.   
  113.   int (*ReadStream)(fmHandle strHandle, ui8 *buf, unsigned int size);  
  114.   // Reads size program stream bytes for the given opened stream.  
  115.   //  Returns the actual number of bytes read.
  116.  
  117.   int (*SetStreamPos)(fmHandle strHandle, ui64 pos); 
  118.   // Set the position of the stream if the module supports FM_MISM_READFILES feature
  119.   // Return FM_MISM_ERROR otherwise.
  120.  
  121.   int (*GetStreamPos)(fmHandle strHandle, ui64 *pos);  
  122.   // Get the position of the stream if the module supports FM_MISM_READFILES feature
  123.   // Return FM_MISM_ERROR otherwise.
  124.  
  125.   int (*GetStreams)(fmStreamIds *ids, char *fileName);
  126.   // This function is called by FlasKMPEG to know what streams should be used.
  127.   // Right now only one video stream and one audio stream are allowed. Fill TStreamIds accordingly.
  128.   // fileName is the file from we want to retrieve the streams from
  129.  
  130.   int (*CloseStream)( fmHandle strHandle ); // Close stream
  131.  
  132.   char* (*GetLastError)(void); // Call this to get a description of Last error
  133.   char* (*GetFileName)( fmHandle strHandle ); // Gets the name of the opened file. Returns NULL if no file is opened.
  134.  
  135.   // Stats info ptrs
  136.   char* (*GetStreamStatus)( fmHandle strHandle ); // Gets a textual description of the status of the module
  137.   ui64 (*GetStreamSize)( fmHandle strHandle );    // total size of the stream if the module supports FM_MISM_READFILES
  138.  
  139.   void (*Init)( LPFMMismStdParms parms );
  140.   void (*DeInit)( void );
  141.  
  142. } FMMismInfo,*LPFMMismInfo;
  143.  
  144. // The library must export this function
  145. // void fmGetMism(LPFMMismInfo mismInfo);
  146. typedef void (*fmGetMismPtr)(LPFMMismInfo pMismInfo);
  147.  
  148. #endif