⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rmalvpix.pas

📁 Delphi源码REAlRMSDK.rar
💻 PAS
字号:
unit RmaLvPix;

interface

uses
  PnResult, PnTypes, RmaPckts;

(****************************************************************************
 *
 *  rmalvpix.h
 *
 *  Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved.
 *
 *  http://www.real.com/devzone
 *
 *  This program contains proprietary
 *  information of Progressive Networks, Inc, and is licensed
 *  subject to restrictions on use and distribution.
 *
 *
 *  RealPix live encoder interfaces
 *
 *)

(*
 * PixInitInfo
 *
 * This struct contains initialization information
 * and is passed in in the IRMALiveRealPix::StartEncoder()
 * method. All of the members of this struct are input variables.
 *)

type
  _PixInitInfo = record
    m_ulStructLength: UINT32;       (* length in bytes of this structure *)
    m_pServerAddress: PChar;        (* name or ip address of server *)
    m_ulServerPort: UINT32;         (* pn-encoder port on server *)
    m_pUsername: PChar;             (* username for authentication on server *)
    m_pPassword: PChar;             (* password for authentication on server *)
    m_pFilename: PChar;             (* filename which clients should open *)
    m_pTitle: PChar;                (* title of live presentation *)
    m_pAuthor: PChar;               (* author of live presentation *)
    m_pCopyright: PChar;            (* copyright on live presentation *)
    m_ulBitrate: UINT32;            (* bitrate of realpix stream *)
    m_ulMaxFps: UINT32;             (* max frames per second of effects *)
    m_ulDisplayWidth: UINT32;       (* display width in pixels *)
    m_ulDisplayHeight: UINT32;      (* display height in pixels *)
    m_bPreserveAspect: BOOL;        (* preserve aspect ratio by default? *)
    m_pDefaultURL: PChar;           (* default URL to send browser to when clicked *)
    m_ulNumImageCodecs: UINT32;     (* number of image codecs used in this stream *)
    m_ppImageCodec: ^PChar;         (* string names of codecs *)
    m_ulNumEffectPackages: UINT32;  (* number of external effect packages used *)
    m_ppEffectPackage: ^PChar;      (* string names of effect packages*)
  end;
  {$EXTERNALSYM _PixInitInfo}
  PixInitInfo = _PixInitInfo;
  {$EXTERNALSYM PixInitInfo}

(*
 * PixImageInfo
 *
 * This struct contains all the information for images which
 * should be sent down the stream. This struct is used in the 
 * IRMALiveRealPix::InitImage() method.
 *)

  _PixImageInfo = record
    m_ulStructLength: UINT32;      (* Input:  size of struct *)
    m_pImageBuffer: PBYTE;         (* Input:  buffer holding image data *)
    m_ulImageBufferSize: UINT32;   (* Input:  size of image buffer *)
    m_pImageCodec: PChar;          (* Input:  image codec to be used *)
    m_ulHandle: UINT32;            (* Output: image handle *)
    m_ulNumPackets: UINT32;        (* Output: number of packets image will be sent *)
    m_ulTimeToSend: UINT32;        (* Output: milliseconds required to send image *)
  end;
  {$EXTERNALSYM _PixImageInfo}
  PixImageInfo = _PixImageInfo;
  {$EXTERNALSYM PixImageInfo}

const
  EFFECT_FILL          = 0;
  {$EXTERNALSYM EFFECT_FILL}
  EFFECT_FADEIN        = 1;
  {$EXTERNALSYM EFFECT_FADEIN}
  EFFECT_FADEOUT       = 2;
  {$EXTERNALSYM EFFECT_FADEOUT}
  EFFECT_CROSSFADE     = 3;
  {$EXTERNALSYM EFFECT_CROSSFADE}
  EFFECT_WIPE          = 4;
  {$EXTERNALSYM EFFECT_WIPE}
  EFFECT_VIEWCHANGE    = 5;
  {$EXTERNALSYM EFFECT_VIEWCHANGE}
  EFFECT_EXTERNAL      = 6;
  {$EXTERNALSYM EFFECT_EXTERNAL}
  EFFECT_ANIMATE       = 7;
  {$EXTERNALSYM EFFECT_ANIMATE}

  WIPE_DIRECTION_UP    = 0;
  {$EXTERNALSYM WIPE_DIRECTION_UP}
  WIPE_DIRECTION_DOWN  = 1;
  {$EXTERNALSYM WIPE_DIRECTION_DOWN}
  WIPE_DIRECTION_LEFT  = 2;
  {$EXTERNALSYM WIPE_DIRECTION_LEFT}
  WIPE_DIRECTION_RIGHT = 3;
  {$EXTERNALSYM WIPE_DIRECTION_RIGHT}

  WIPE_TYPE_NORMAL     = 0;
  {$EXTERNALSYM WIPE_TYPE_NORMAL}
  WIPE_TYPE_PUSH       = 1;
  {$EXTERNALSYM WIPE_TYPE_PUSH}

(*
 * PixEffectInfo
 *
 * This struct contains all the information about the effect which 
 * the RealPix renderer should perform. This struct is used in the
 * IRMALiveRealPix::SendEffect() method.
 *)

type
  _PixEffectInfo = record
    m_ulStructLength: UINT32;      (* Input:  Length in bytes of this struct *)
    m_ucEffectType: BYTE;          (* Input:  Effect Type: EFFECT_FILL, EFFECT_FADEIN, etc. *)
    m_ulStart: UINT32;             (* Input:  Start time in milliseconds of effect *)
    m_ulDuration: UINT32;          (* Input:  Duration in milliseconds of effect *)
    m_ulTarget: UINT32;            (* Input:  Handle of image to perform effect on *)
    m_ulSrcX: UINT32;              (* Input:  Horizontal offset of source rectangle *)
    m_ulSrcY: UINT32;              (* Input:  Vertical offset of source rectangle *)
    m_ulSrcW: UINT32;              (* Input:  Width of source rectangle *)
    m_ulSrcH: UINT32;              (* Input:  Height of source rectangle *)
    m_ulDstX: UINT32;              (* Input:  Horizontal offset of destination rectangle *)
    m_ulDstY: UINT32;              (* Input:  Vertical offset of destination rectangle *)
    m_ulDstW: UINT32;              (* Input:  Width of destination rectangle *)
    m_ulDstH: UINT32;              (* Input:  Height of destination rectangle *)
    m_ulMaxFps: UINT32;            (* Input:  Max frames per second for this effect *)
    m_bAspectFlag: BOOL;           (* Input:  TRUE: preserve aspect on this effect; FALSE: don't preserve *)
    m_ucRed: BYTE;                 (* Input:  Red component of fill or fadeout color *)
    m_ucGreen: BYTE;               (* Input:  Green component of fill or fadeout color *)
    m_ucBlue: BYTE;                (* Input:  Blue component of fill or fadeout color *)
    m_ucWipeDirection: BYTE;       (* Input:  WIPE_DIRECTION_xxx, where xxx is UP, DOWN, LEFT, or RIGHT *)
    m_ucWipeType: BYTE;            (* Input:  WIPE_TYPE_NORMAL or WIPE_TYPE_PUSH *)
    m_pURL: PChar;                 (* Input:  URL for this effect *)
    m_pExtPackage: PChar;          (* Input:  Name of external effect package *)
    m_pExtName: PChar;             (* Input:  Name of external effect within the package *)
    m_pExtData: PChar;             (* Input   Opaque string data for external effect *)
    m_pExtFile: PChar;             (* Input:  File contents of external effect data *)
    m_bDiscardImage: BOOL;         (* Input:  TRUE: discard image after doing effect; FALSE: don't discard *)
    m_bDisplayImmediately: BOOL;   (* Input:  FALSE: obey start time; TRUE: do effect immediately *)
    m_ulHandle: UINT32;            (* Output: Handle by which effect will be referred to *)
  end;
  {$EXTERNALSYM _PixEffectInfo}
  PixEffectInfo = _PixEffectInfo;
  {$EXTERNALSYM PixEffectInfo}

(*
 * Declaration of the DLL entry point
 *)

// MVB TODO
// STDAPI CreateLiveRealPix(IRMALiveRealPix **);
//
// typedef PN_RESULT (PNEXPORT_PTR FPRMCREATELIVEREALPIX)(IRMALiveRealPix **ppLiveRealPix);

(****************************************************************************
 *
 *  Interface:
 *
 *  IRMALiveRealPixResponse
 * 
 *  Purpose:
 * 
 *  Asynchronous response interface that allows an application to
 *  encode live RealPix
 * 
 *  IID_IRMALiveRealPixResponse:
 * 
 *  {E7ADF46C-477D-11d2-AA0C-0060972D23A7}
 *
 *)

const
  IID_IRMALiveRealPixResponse: TGUID = '{E7ADF46C-477D-11d2-AA0C-0060972D23A7}';
  {$EXTERNALSYM IID_IRMALiveRealPixResponse}

type
  IRMALiveRealPixResponse = interface (IUnknown)
  ['{E7ADF46C-477D-11d2-AA0C-0060972D23A7}']

    (*
     * EncoderStarted() is the asynchronous response to StartEncoder(). The status
     * argument tells whether initializing the server was successful or not, and the pszHeaderString
     * argument returns the text string returned by the RealServer.
     *)

    function EncoderStarted(status: PN_RESULT; pszHeaderString: PChar): HRESULT; stdcall;

    (*
     * ImageSent() is the asynchronous response to SendImage(). The ulImageHandle argument
     * identifies which image has just completed sending to the server, and the status
     * argument tells whether or not the send was successful or not.
     *)

    function ImageSent(status: PN_RESULT; ulImageHandle: UINT32): HRESULT; stdcall;

    (*
     * EffectSent() is the asynchronous response to SendEffect(). The ulEffectHandle argument
     * identifies which effect has just completed sending to the server, and the status
     * argument tells whether or not the send was successful or not.
     *)

    function EffectSent(status: PN_RESULT; ulEffectHandle: UINT32): HRESULT; stdcall;

    (*
     * EncoderStopped() is the asynchronous response to StopEncoder(). The status
     * argument tells whether or not the stopping of the encoder was successful.
     * If the status is PNR_OK, then the application can then shut down or turn
     * around and call StartEncoder() again.
     *)

    function EncoderStopped(status: PN_RESULT): HRESULT; stdcall;

    (*
     * ErrorOccurred() is called when the encoder receives an error from the RealServer.
     * Depending upon the severity of the error, the RealServer may then shut down
     * the encoder and an EncoderStopped() call would be made. Therefore, the
     * application should be ready to handle an EncoderStopped() call at any time.
     * If an error occurs, it's probably a good idea to call StopEncoder() and shut
     * down the encoder from the application side anyway.
     *)

    function ErrorOccurred(unSeverity: UINT8; ulRMACode, ulUserCode: ULONG32;
      pszUserString, pszMoreInfoURL: PChar): HRESULT; stdcall;

  end;
  {$EXTERNALSYM IRMALiveRealPixResponse}

(****************************************************************************
 *
 *  Interface:
 *
 *  IRMALivePix
 *
 *  Purpose:
 *
 *  Asynchronous interface that allows an application to encode live RealPix
 *
 *  IID_IRMALiveRealPix:
 *
 *  {E7ADF466-477D-11d2-AA0C-0060972D23A7}
 *
 *)

const
  IID_IRMALiveRealPix: TGUID = '{E7ADF466-477D-11d2-AA0C-0060972D23A7}';
  {$EXTERNALSYM IID_IRMALiveRealPix}

type
  IRMALiveRealPix = interface (IUnknown)
  ['{E7ADF466-477D-11d2-AA0C-0060972D23A7}']

    (*
     * StartEncoder() must be called before anything else and a pointer to
     * an IRMALiveRealPixResponse interface must be passed in. The encoder will
     * respond to this call asynchronously with IRMALiveRealPixResponse::EncoderStarted().
     *)

    function StartEncoder(const pInitInfo: PixInitInfo; pResponse: IRMALiveRealPixResponse): HRESULT; stdcall;

    (*
     * InitImage() is called to prep an image for being sent. It returns several useful
     * pieces of information which the caller can make use of: the handle to refer to
     * the image in SendImage(), the number of packets this image will be broken up into,
     * and the time required to send this image in milliseconds. Note that InitImage()
     * simply breaks the image up into packets - nothing has been sent to the server yet.
     * This is not an asynchronous call - all processing has finished by the time this
     * call returns.
     *)

    function InitImage(const pImageInfo: PixImageInfo): HRESULT; stdcall;

    (*
     * SendImage() tranfers the all the packets for the image referred to by ulImageHandle
     * into the packet send queue. Further calls to Process() will result in these
     * packets being sent to the RealServer. When all the packets for this image have
     * been sent, the encoder will respond with IRMALiveRealPixResponse::ImageSent().
     *)

    function SendImage(ulImageHandle: UINT32): HRESULT; stdcall;

    (*
     * SendEffect() creates an effect packet with the information contained in
     * the PixEffectInfo struct and immediately adds this packet to the packet
     * send queue. Further calls to Process() will result in this packet being
     * sent to the server. A handle is returned in the PixEffectInfo struct by
     * which this effect can later be identified. When the effect has been
     * sent to the server, the encoder will respond with
     * IRMALiveRealPixResponse::EffectSent().
     *)

    function SendEffect(var pEffectInfo: PixEffectInfo): HRESULT; stdcall;

    (*
     * StopEncoder() may be called at any time after calling StartEncoder().
     * This tells the encoder that no more images of effects are going to
     * be sent to the encoder. The encoder shuts down the connection to
     * the server and responds with IRMALiveRealPixResponse::EncoderStopped().
     *)

    function StopEncoder: HRESULT; stdcall;

    (*
     * GetTime() returns the time in milliseconds since the encoder library was initialized.
     *)

    function GetTime: UINT32; stdcall;

    (*
     * Process() must be called in order to give the library time to send
     * packets to the server. It should be called very often in between SendImage()
     * and ImageSent(), as well as between SendEffect() and EffectSent(). Other
     * that these times, it should be called every 3-5 seconds.
     *)

    function Process: HRESULT; stdcall;

  end;
  {$EXTERNALSYM IRMALiveRealPix}

(****************************************************************************
 *
 *  Interface:
 *
 *  IRMALiveRealPixResend
 *
 *  Purpose:
 *
 *  Allows re-sending and releasing of images with IRMALiveRealPix
 *
 *  IID_IRMALiveRealPixResend:
 *
 *  {D814DA11-8B02-11D3-8AF3-00C0F030B4E5}
 *)

const
  IID_IRMALiveRealPixResend: TGUID = '{D814DA11-8B02-11D3-8AF3-00C0F030B4E5}';
  {$EXTERNALSYM IID_IRMALiveRealPixResend}

type
  IRMALiveRealPixResend = interface (IUnknown)
  ['{D814DA11-8B02-11D3-8AF3-00C0F030B4E5}']

    (*
     * InitResend() informs the encoder that from now on, after an
     * image is sent with SendImage() it should not be discarded
     * but held in the encoder until ReleaseImage() is called().
     *)

    function InitResend(pOptions: IRMAValues): HRESULT; stdcall;

    (*
     * ReleaseImage() informs the encoder that the application no longer
     * intends to call SendImage() on the image referenced by ulImageHandle
     * and that it can discard the image. Further calls to SendImage(x) will
     * return PNR_UNKNOWN_IMAGE after ReleaseImage(x) has been called.
     * ReleaseImage(x) will return PNR_UNKNOWN_IMAGE if x is an unknown handle.
     *)

    function ReleaseImage(ulImageHandle: UINT32): HRESULT; stdcall;

    (*
     * DumpAllQueuedPackets() clears any packets currently waiting to be
     * sent to the server. These packets were put on the send queue by
     * either IRMALiveRealPix::SendImage() or IRMALiveRealPix::SendEffect().
     *)

    function DumpAllQueuedPackets: HRESULT; stdcall;

  end;
  {$EXTERNALSYM IRMALiveRealPixResend}

implementation

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -