MMMPEG.INT 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. {========================================================================}
  2. {= (c) 1995-98 SwiftSoft Ronald Dittrich =}
  3. {========================================================================}
  4. {= All Rights Reserved =}
  5. {========================================================================}
  6. {= D 01099 Dresden = Fax.: +49 (0)351-8037944 =}
  7. {= Loewenstr.7a = info@swiftsoft.de =}
  8. {========================================================================}
  9. {= Actual versions on http://www.swiftsoft.de/mmtools.html =}
  10. {========================================================================}
  11. {= This code is for reference purposes only and may not be copied or =}
  12. {= distributed in any format electronic or otherwise except one copy =}
  13. {= for backup purposes. =}
  14. {= =}
  15. {= No Delphi Component Kit or Component individually or in a collection=}
  16. {= subclassed or otherwise from the code in this unit, or associated =}
  17. {= .pas, .dfm, .dcu, .asm or .obj files may be sold or distributed =}
  18. {= without express permission from SwiftSoft. =}
  19. {= =}
  20. {= For more licence informations please refer to the associated =}
  21. {= HelpFile. =}
  22. {========================================================================}
  23. {= $Date: 14.04.98 - 13:59:29 $ =}
  24. {========================================================================}
  25. unit MMMPEG;
  26. {$I COMPILER.INC}
  27. {$DEFINE USEMPEGDLL}
  28. interface
  29. uses
  30. Windows,
  31. SysUtils,
  32. Classes,
  33. Dialogs,
  34. Consts,
  35. DsgnIntf,
  36. MMSystem,
  37. MMObj,
  38. MMDSPObj,
  39. MMRegs,
  40. MMUtils,
  41. MMString,
  42. MMPCMSup,
  43. MMMPType
  44. {$IFNDEF USEMPEGDLL}
  45. ,Wrapper
  46. {$ENDIF}
  47. ;
  48. type
  49. EMMMpegError = class(Exception);
  50. {-- TMMMpeg -----------------------------------------------------------------}
  51. TMMMpeg = class(TMMObject)
  52. public
  53. constructor Create; virtual;
  54. destructor Destroy; override;
  55. procedure FreeMpeg;
  56. procedure Assign(Source: TPersistent); override;
  57. procedure LoadFromFile(const AFilename: string);
  58. property Empty: Boolean read GetEmpty;
  59. property Done: Boolean read GetDone;
  60. property TimePerFrame: Longint read GetTimePerFrame;
  61. property Position: Longint read GetPosition write SetPosition;
  62. property PWaveFormat: PWaveFormatEx read GetPWaveFormat;
  63. procedure OpenFile;
  64. procedure ResetFile;
  65. procedure CloseFile;
  66. function ReadDataBytes(Buffer: PChar; NumBytes: Longint): Longint;
  67. published
  68. property OnChange: TNotifyEvent read FOnChange write FOnChange;
  69. property TrailingHeader: Longint read FTrailing write SetTrailingHeader;
  70. property FileName: TFileName read GetFileName write SetFileName;
  71. property Version: TMpegVersion read GetVersion write SetVersion;
  72. property Layer: integer read GetLayer write SetLayer;
  73. property Mode: TSampleMode read GetMode write SetMode;
  74. property BitRate: integer read GetBitRate write SetBitRate;
  75. property SampleRate: Longint read GetSampleRate write SetLongint;
  76. property PlayBackRate: Longint read GetPlayBackRate write SetLongint;
  77. property Frames: Longint read GetFrames write SetLongint;
  78. property Time: Longint read GetTime write SetLongint;
  79. property ChannelMode: TChannelMode read GetChannelMode write SetChannelMode;
  80. end;
  81. {-- TMMMpegFile -------------------------------------------------------}
  82. TMMMPEGFile = class(TMMDSPComponent)
  83. public
  84. constructor Create(AOwner: TComponent); override;
  85. destructor Destroy; override;
  86. procedure SetDecodeCallback(Callback: TMpegDecodeProc);
  87. procedure FreeMpeg;
  88. procedure Assign(Source: TPersistent); override;
  89. procedure LoadFromFile(const AFilename: string);
  90. property Empty: Boolean read GetEmpty;
  91. property TimePerFrame: Longint read GetTimePerFrame;
  92. property Position: Longint read GetPosition write SetPosition;
  93. procedure OpenFile;
  94. procedure CloseFile;
  95. function ReadDataBytes(Buffer: PChar; NumBytes: Longint): Longint;
  96. published
  97. property OnChange: TNotifyEvent read FOnChange write FOnChange;
  98. property Output;
  99. property Enabled: Boolean read FEnabled write FEnabled default True;
  100. property TrailingHeader: Longint read GetTrailingHeader write SetTrailingHeader;
  101. property FileName: TFileName read GetFileName write SetFileName;
  102. property Version: TMpegVersion read GetVersion write SetVersion;
  103. property Layer: integer read GetLayer write SetLayer;
  104. property Mode: TSampleMode read GetMode write SetMode;
  105. property BitRate: integer read GetBitRate write SetBitRate;
  106. property SampleRate: Longint read GetSampleRate write SetLongint;
  107. property PlayBackRate: Longint read GetPlayBackRate write SetLongint;
  108. property Frames: Longint read GetFrames write SetLongint;
  109. property Time: Longint read GetTime write SetLongint;
  110. property ChannelMode: TChannelMode read GetChannelMode write SetChannelMode;
  111. end;
  112. function IsMpegFile(aFileName: TFileName): Boolean;
  113. function GetMpegFileInfo(aFileName: TFileName; var Info: TMpegFileInfo): Boolean;
  114. implementation