unit RtspPullClientLib_TLB;

// ************************************************************************ //
// WARNING                                                                    
// -------                                                                    
// The types declared in this file were generated from data read from a       
// Type Library. If this type library is explicitly or indirectly (via        
// another type library referring to this type library) re-imported, or the   
// 'Refresh' command of the Type Library Editor activated while editing the   
// Type Library, the contents of this file will be regenerated and all        
// manual modifications will be lost.                                         
// ************************************************************************ //

// PASTLWTR : 1.2
// File generated on 2011-9-20 11:14:29 from Type Library described below.

// ************************************************************************  //
// Type Lib: H:\新平台新LIB\旧控件\StreamPlayer\Release\RtspPullClient.dll (1)
// LIBID: {328AAFFD-214A-41D1-9991-5392E4ADA991}
// LCID: 0
// Helpfile: 
// HelpString: RtspPullClient 1.0 类型库
// DepndLst: 
//   (1) v2.0 stdole, (C:\WINDOWS\system32\stdole2.tlb)
// ************************************************************************ //
// *************************************************************************//
// NOTE:                                                                      
// Items guarded by $IFDEF_LIVE_SERVER_AT_DESIGN_TIME are used by properties  
// which return objects that may need to be explicitly created via a function 
// call prior to any access via the property. These items have been disabled  
// in order to prevent accidental use from within the object inspector. You   
// may enable them by defining LIVE_SERVER_AT_DESIGN_TIME or by selectively   
// removing them from the $IFDEF blocks. However, such items must still be    
// programmatically created via a method of the appropriate CoClass before    
// they can be used.                                                          
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. 
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}
{$VARPROPSETTER ON}
interface

uses Windows, ActiveX, Classes, Graphics, OleCtrls, OleServer, StdVCL, Variants;
  


// *********************************************************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:        
//   Type Libraries     : LIBID_xxxx                                      
//   CoClasses          : CLASS_xxxx                                      
//   DISPInterfaces     : DIID_xxxx                                       
//   Non-DISP interfaces: IID_xxxx                                        
// *********************************************************************//
const
  // TypeLibrary Major and minor versions
  RtspPullClientLibMajorVersion = 1;
  RtspPullClientLibMinorVersion = 0;

  LIBID_RtspPullClientLib: TGUID = '{328AAFFD-214A-41D1-9991-5392E4ADA991}';

  DIID__IRtspPullClientCtrlEvents: TGUID = '{1C1EE5B3-AF61-40E1-8F06-B404FBDBEAD6}';
  IID_IRtspPullClientCtrl: TGUID = '{48C42D33-367E-491E-9C93-F00338EEEAFC}';
  CLASS_RtspPullClientCtrl: TGUID = '{E12AC8B0-57BF-4DA8-AEF8-565206486AB9}';
type

// *********************************************************************//
// Forward declaration of types defined in TypeLibrary                    
// *********************************************************************//
  _IRtspPullClientCtrlEvents = dispinterface;
  IRtspPullClientCtrl = interface;
  IRtspPullClientCtrlDisp = dispinterface;

// *********************************************************************//
// Declaration of CoClasses defined in Type Library                       
// (NOTE: Here we map each CoClass to its Default Interface)              
// *********************************************************************//
  RtspPullClientCtrl = IRtspPullClientCtrl;


// *********************************************************************//
// Declaration of structures, unions and aliases.                         
// *********************************************************************//
  PByte1 = ^Byte; {*}
  PInteger1 = ^Integer; {*}


// *********************************************************************//
// DispIntf:  _IRtspPullClientCtrlEvents
// Flags:     (4096) Dispatchable
// GUID:      {1C1EE5B3-AF61-40E1-8F06-B404FBDBEAD6}
// *********************************************************************//
  _IRtspPullClientCtrlEvents = dispinterface
    ['{1C1EE5B3-AF61-40E1-8F06-B404FBDBEAD6}']
    procedure NetworkEvent(StreamID: Integer; EventID: Integer; const EventString: WideString); dispid 1;
    procedure MediaRecv(StreamID: Integer; MediaType: Integer; var pData: Byte; DataLength: Integer); dispid 2;
    procedure VideoRecv(StreamID: Integer; var pFrame: Byte; FrameLength: Integer; 
                        var pExtra: Byte; ExtraLength: Integer); dispid 3;
    procedure AudioRecv(StreamID: Integer; var pFrame: Byte; FrameLength: Integer; 
                        var pExtra: Byte; ExtraLength: Integer); dispid 4;
  end;

// *********************************************************************//
// Interface: IRtspPullClientCtrl
// Flags:     (4544) Dual NonExtensible OleAutomation Dispatchable
// GUID:      {48C42D33-367E-491E-9C93-F00338EEEAFC}
// *********************************************************************//
  IRtspPullClientCtrl = interface(IDispatch)
    ['{48C42D33-367E-491E-9C93-F00338EEEAFC}']
    function Add(const pUrl: WideString; const pUser: WideString; const pPassword: WideString): Integer; safecall;
    function Delete(StreamID: Integer): Integer; safecall;
    function AddEx(const pUrl: WideString; const pUser: WideString; const pPassword: WideString; 
                   RTPOverRTSP: Integer): Integer; safecall;
    function SetTCS(const strServer: WideString; usServerPort: Word): Integer; safecall;
    function AddRemote(const strSerialNumber: WideString; usPort: Word; 
                       const strStreamName: WideString; const strUsername: WideString; 
                       const strPassword: WideString; RTPOverRTSP: Integer): Integer; safecall;
    function StopAll: Integer; safecall;
    function StopStreams(var stream_list: Integer; count: SYSINT): Integer; safecall;
    function RegisterReader(StreamID: Integer; ReaderID: Integer): Integer; safecall;
    function UnregisterReader(StreamID: Integer; ReaderID: Integer): Integer; safecall;
    function ReadOneVideoFrame(StreamID: Integer; ReaderID: Integer; var pVideoBuf: Byte; 
                               var pVideoBufSize: Integer; var pExtraBuf: Byte; 
                               var pExtraBufSize: Integer): Integer; safecall;
    function ReadOneAudioFrame(StreamID: Integer; ReaderID: Integer; var pAudioBuf: Byte; 
                               var pAudioBufSize: Integer; var pExtraBuf: Byte; 
                               var pExtraBufSize: Integer): Integer; safecall;
  end;

// *********************************************************************//
// DispIntf:  IRtspPullClientCtrlDisp
// Flags:     (4544) Dual NonExtensible OleAutomation Dispatchable
// GUID:      {48C42D33-367E-491E-9C93-F00338EEEAFC}
// *********************************************************************//
  IRtspPullClientCtrlDisp = dispinterface
    ['{48C42D33-367E-491E-9C93-F00338EEEAFC}']
    function Add(const pUrl: WideString; const pUser: WideString; const pPassword: WideString): Integer; dispid 1;
    function Delete(StreamID: Integer): Integer; dispid 2;
    function AddEx(const pUrl: WideString; const pUser: WideString; const pPassword: WideString; 
                   RTPOverRTSP: Integer): Integer; dispid 3;
    function SetTCS(const strServer: WideString; usServerPort: {??Word}OleVariant): Integer; dispid 4;
    function AddRemote(const strSerialNumber: WideString; usPort: {??Word}OleVariant; 
                       const strStreamName: WideString; const strUsername: WideString; 
                       const strPassword: WideString; RTPOverRTSP: Integer): Integer; dispid 5;
    function StopAll: Integer; dispid 6;
    function StopStreams(var stream_list: Integer; count: SYSINT): Integer; dispid 7;
    function RegisterReader(StreamID: Integer; ReaderID: Integer): Integer; dispid 10;
    function UnregisterReader(StreamID: Integer; ReaderID: Integer): Integer; dispid 11;
    function ReadOneVideoFrame(StreamID: Integer; ReaderID: Integer; var pVideoBuf: Byte; 
                               var pVideoBufSize: Integer; var pExtraBuf: Byte; 
                               var pExtraBufSize: Integer): Integer; dispid 12;
    function ReadOneAudioFrame(StreamID: Integer; ReaderID: Integer; var pAudioBuf: Byte; 
                               var pAudioBufSize: Integer; var pExtraBuf: Byte; 
                               var pExtraBufSize: Integer): Integer; dispid 13;
  end;


// *********************************************************************//
// OLE Control Proxy class declaration
// Control Name     : TRtspPullClientCtrl
// Help String      : RtspPullClientCtrl Class
// Default Interface: IRtspPullClientCtrl
// Def. Intf. DISP? : No
// Event   Interface: _IRtspPullClientCtrlEvents
// TypeFlags        : (34) CanCreate Control
// *********************************************************************//
  TRtspPullClientCtrlNetworkEvent = procedure(ASender: TObject; StreamID: Integer; 
                                                                EventID: Integer; 
                                                                const EventString: WideString) of object;
  TRtspPullClientCtrlMediaRecv = procedure(ASender: TObject; StreamID: Integer; MediaType: Integer; 
                                                             var pData: Byte; DataLength: Integer) of object;
  TRtspPullClientCtrlVideoRecv = procedure(ASender: TObject; StreamID: Integer; var pFrame: Byte; 
                                                             FrameLength: Integer; 
                                                             var pExtra: Byte; ExtraLength: Integer) of object;
  TRtspPullClientCtrlAudioRecv = procedure(ASender: TObject; StreamID: Integer; var pFrame: Byte; 
                                                             FrameLength: Integer; 
                                                             var pExtra: Byte; ExtraLength: Integer) of object;

  TRtspPullClientCtrl = class(TOleControl)
  private
    FOnNetworkEvent: TRtspPullClientCtrlNetworkEvent;
    FOnMediaRecv: TRtspPullClientCtrlMediaRecv;
    FOnVideoRecv: TRtspPullClientCtrlVideoRecv;
    FOnAudioRecv: TRtspPullClientCtrlAudioRecv;
    FIntf: IRtspPullClientCtrl;
    function  GetControlInterface: IRtspPullClientCtrl;
  protected
    procedure CreateControl;
    procedure InitControlData; override;
  public
    function Add(const pUrl: WideString; const pUser: WideString; const pPassword: WideString): Integer;
    function Delete(StreamID: Integer): Integer;
    function AddEx(const pUrl: WideString; const pUser: WideString; const pPassword: WideString; 
                   RTPOverRTSP: Integer): Integer;
    function SetTCS(const strServer: WideString; usServerPort: Word): Integer;
    function AddRemote(const strSerialNumber: WideString; usPort: Word; 
                       const strStreamName: WideString; const strUsername: WideString; 
                       const strPassword: WideString; RTPOverRTSP: Integer): Integer;
    function StopAll: Integer;
    function StopStreams(var stream_list: Integer; count: SYSINT): Integer;
    function RegisterReader(StreamID: Integer; ReaderID: Integer): Integer;
    function UnregisterReader(StreamID: Integer; ReaderID: Integer): Integer;
    function ReadOneVideoFrame(StreamID: Integer; ReaderID: Integer; var pVideoBuf: Byte; 
                               var pVideoBufSize: Integer; var pExtraBuf: Byte; 
                               var pExtraBufSize: Integer): Integer;
    function ReadOneAudioFrame(StreamID: Integer; ReaderID: Integer; var pAudioBuf: Byte; 
                               var pAudioBufSize: Integer; var pExtraBuf: Byte; 
                               var pExtraBufSize: Integer): Integer;
    property  ControlInterface: IRtspPullClientCtrl read GetControlInterface;
    property  DefaultInterface: IRtspPullClientCtrl read GetControlInterface;
  published
    property Anchors;
    property OnNetworkEvent: TRtspPullClientCtrlNetworkEvent read FOnNetworkEvent write FOnNetworkEvent;
    property OnMediaRecv: TRtspPullClientCtrlMediaRecv read FOnMediaRecv write FOnMediaRecv;
    property OnVideoRecv: TRtspPullClientCtrlVideoRecv read FOnVideoRecv write FOnVideoRecv;
    property OnAudioRecv: TRtspPullClientCtrlAudioRecv read FOnAudioRecv write FOnAudioRecv;
  end;

procedure Register;

resourcestring
  dtlServerPage = 'COM+';

  dtlOcxPage = 'COM+';

implementation

uses ComObj;

procedure TRtspPullClientCtrl.InitControlData;
const
  CEventDispIDs: array [0..3] of DWORD = (
    $00000001, $00000002, $00000003, $00000004);
  CControlData: TControlData2 = (
    ClassID: '{E12AC8B0-57BF-4DA8-AEF8-565206486AB9}';
    EventIID: '{1C1EE5B3-AF61-40E1-8F06-B404FBDBEAD6}';
    EventCount: 4;
    EventDispIDs: @CEventDispIDs;
    LicenseKey: nil (*HR:$80004002*);
    Flags: $00000000;
    Version: 401);
begin
  ControlData := @CControlData;
  TControlData2(CControlData).FirstEventOfs := Cardinal(@@FOnNetworkEvent) - Cardinal(Self);
end;

procedure TRtspPullClientCtrl.CreateControl;

  procedure DoCreate;
  begin
    FIntf := IUnknown(OleObject) as IRtspPullClientCtrl;
  end;

begin
  if FIntf = nil then DoCreate;
end;

function TRtspPullClientCtrl.GetControlInterface: IRtspPullClientCtrl;
begin
  CreateControl;
  Result := FIntf;
end;

function TRtspPullClientCtrl.Add(const pUrl: WideString; const pUser: WideString; 
                                 const pPassword: WideString): Integer;
begin
  Result := DefaultInterface.Add(pUrl, pUser, pPassword);
end;

function TRtspPullClientCtrl.Delete(StreamID: Integer): Integer;
begin
  Result := DefaultInterface.Delete(StreamID);
end;

function TRtspPullClientCtrl.AddEx(const pUrl: WideString; const pUser: WideString; 
                                   const pPassword: WideString; RTPOverRTSP: Integer): Integer;
begin
  Result := DefaultInterface.AddEx(pUrl, pUser, pPassword, RTPOverRTSP);
end;

function TRtspPullClientCtrl.SetTCS(const strServer: WideString; usServerPort: Word): Integer;
begin
  Result := DefaultInterface.SetTCS(strServer, usServerPort);
end;

function TRtspPullClientCtrl.AddRemote(const strSerialNumber: WideString; usPort: Word; 
                                       const strStreamName: WideString; 
                                       const strUsername: WideString; 
                                       const strPassword: WideString; RTPOverRTSP: Integer): Integer;
begin
  Result := DefaultInterface.AddRemote(strSerialNumber, usPort, strStreamName, strUsername, 
                                       strPassword, RTPOverRTSP);
end;

function TRtspPullClientCtrl.StopAll: Integer;
begin
  Result := DefaultInterface.StopAll;
end;

function TRtspPullClientCtrl.StopStreams(var stream_list: Integer; count: SYSINT): Integer;
begin
  Result := DefaultInterface.StopStreams(stream_list, count);
end;

function TRtspPullClientCtrl.RegisterReader(StreamID: Integer; ReaderID: Integer): Integer;
begin
  Result := DefaultInterface.RegisterReader(StreamID, ReaderID);
end;

function TRtspPullClientCtrl.UnregisterReader(StreamID: Integer; ReaderID: Integer): Integer;
begin
  Result := DefaultInterface.UnregisterReader(StreamID, ReaderID);
end;

function TRtspPullClientCtrl.ReadOneVideoFrame(StreamID: Integer; ReaderID: Integer; 
                                               var pVideoBuf: Byte; var pVideoBufSize: Integer; 
                                               var pExtraBuf: Byte; var pExtraBufSize: Integer): Integer;
begin
  Result := DefaultInterface.ReadOneVideoFrame(StreamID, ReaderID, pVideoBuf, pVideoBufSize, 
                                               pExtraBuf, pExtraBufSize);
end;

function TRtspPullClientCtrl.ReadOneAudioFrame(StreamID: Integer; ReaderID: Integer; 
                                               var pAudioBuf: Byte; var pAudioBufSize: Integer; 
                                               var pExtraBuf: Byte; var pExtraBufSize: Integer): Integer;
begin
  Result := DefaultInterface.ReadOneAudioFrame(StreamID, ReaderID, pAudioBuf, pAudioBufSize, 
                                               pExtraBuf, pExtraBufSize);
end;

procedure Register;
begin
  RegisterComponents(dtlOcxPage, [TRtspPullClientCtrl]);
end;

end.
