📄 rmalvtxt.pas
字号:
unit RmaLvTxt;
interface
uses
PnResult, PnTypes;
(****************************************************************************
*
* $Id: rmalvtxt.h,v 1.14 1999/01/29 18:32:12 hboone Exp $
*
* 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.
*
*
* RealText encoder class using the SuperEncoder library.
*
*)
(* These need to be visible to rtlive and to exlvtext: *)
(* For live, duration is max allowed val, or max ulong: *)
const
MAX_ULONG32 = ULONG32($FFFFFFFF);
{$EXTERNALSYM MAX_ULONG32}
MIN_LONG32 = ULONG32($FFFFFFFF);
{$EXTERNALSYM MIN_LONG32}
(* These, too, need to be visible to rtlive and to exlvtext: *)
const
MAX_PACKET_SIZE = 500;
{$EXTERNALSYM MAX_PACKET_SIZE}
USE_DEFAULT_TYPE = 0;
{$EXTERNALSYM USE_DEFAULT_TYPE}
USE_DEFAULT_HEIGHT = MAX_ULONG32;
{$EXTERNALSYM USE_DEFAULT_HEIGHT}
USE_DEFAULT_WIDTH = MAX_ULONG32;
{$EXTERNALSYM USE_DEFAULT_WIDTH}
USE_DEFAULT_SCROLLRATE = MIN_LONG32;
{$EXTERNALSYM USE_DEFAULT_SCROLLRATE}
USE_DEFAULT_CRAWLRATE = MIN_LONG32;
{$EXTERNALSYM USE_DEFAULT_CRAWLRATE}
USE_DEFAULT_BGCOLOR = 0;
{$EXTERNALSYM USE_DEFAULT_BGCOLOR}
USE_DEFAULT_LINKCOLOR = 0;
{$EXTERNALSYM USE_DEFAULT_LINKCOLOR}
USE_DEFAULT_LINKUNDERLINING = $2;
{$EXTERNALSYM USE_DEFAULT_LINKUNDERLINING}
USE_DEFAULT_WORDWRAP = $2;
{$EXTERNALSYM USE_DEFAULT_WORDWRAP}
USE_DEFAULT_DOLOOPING = 0;
{$EXTERNALSYM USE_DEFAULT_DOLOOPING}
USE_DEFAULT_IGNOREEXTRASPACES = FALSE;
{$EXTERNALSYM USE_DEFAULT_IGNOREEXTRASPACES}
const
IID_IRMALiveText: TGUID = '{00001b00-0901-11d1-8b06-00a024406d59}';
{$EXTERNALSYM IID_IRMALiveText}
type
IRMALiveText = interface (IUnknown)
['{00001b00-0901-11d1-8b06-00a024406d59}']
(*
* InitLiveText() must be called before any of the other IRMALiveText
* methods:
*
*
* This is the computer where the
* RMServer is running:
*
* pAddress: PChar;
*
* This is the port number defined in
* the config file where the FSMount
* option has the following entry:
* { /encoder/, pn-encoder, Port=#### }
* where #### is the port number that
* encoders will use:
*
* port: UINT16;
* pUsername: PChar;
* pPassword: PChar;
*
* This is the "file" name that
* RMPlayers can use to view the
* stream. For example, if your
* server was called "srv1" and the
* rtsp port in the config file was
* 8080, and the filename from the
* encoder was "foo.rtx", then a
* player could view the stream by
* opening the following location:
* "rtsp://srv1:8080/encoder/foo.rtx"
*
* pFilename: PChar): HRESULT; stdcall;
*)
function InitLiveText(pAddress: PChar; port: UINT16; pUsername: PChar;
pPassword: PChar; pFilename: PChar): HRESULT; stdcall;
(* ******************************************************************* *)
(* The following methods are to be called prior to sending any data
* and exist as overrides to the default attributes of a RealText
* presentation. Please see the section on the <WINDOW> header tag
* in the realtext.htm in the SDK's doc directory for more information.
* Note: with live text, you do not need a <WINDOW> tag; you must use
* the following methods to set the stream type (e.g., "tickertape"),
* window width, height, background color, ...etc.
*)
function SetType(szType: PChar): HRESULT; stdcall;
function SetWindowDimensions(width, height: ULONG32): HRESULT; stdcall;
function SetTextMotion(scrollrate, crawlrate: LONG32): HRESULT; stdcall;
function SetBackgroundColor(szBackgroundColor: PChar): HRESULT; stdcall;
function SetHyperlinkInfo(underlineHyperlinks: BOOL; szLinkColor: PChar): HRESULT; stdcall;
function UseWordwrap(useWordwrap: BOOL): HRESULT; stdcall;
(*
* This is for "TickerTape"-type windows only; it is ignored by all
* other types:
*)
function SetDoLooping(bDoLooping: BOOL): HRESULT; stdcall;
(* ******************************************************************* *)
(*
* AddData() lets you add text to the stream. The second
* parameter, bSendImmediately, can be used to force the encoder to
* send all text that's been added (and not yet sent) immediately.
* Note: if bSendImmediately is FALSE, the encoder will decide when
* to send the text it has buffered based on the length of the text in
* the buffer and the time since the last packet was sent:
*)
function AddData(szMoreData: PChar; bSendImmediately: BOOL): HRESULT; stdcall;
(*
* AddTickerItem() lets you add "tickertape" text to the stream.
* This method prepends "<TU>" to szTickerUpperData, and
* "<TL>" to szTickerLowerData. Calling:
* AddTickerItem("ABCD", "5 1/2", TRUE)
* is the same as calling
* AddData("<TU>ABCD", FALSE);
* AddData("<TL>5 1/2", TRUE);
* except that the former guarantees that the "upper" and "lower"
* items will be sent in the same packet.
* (Please see the comments above for AddData() for details on use of
* the second parameter, bSendImmediately.
*)
function AddTickerItem(szTickerUpperData, szTickerLowerData: PChar; bSendImmediately: BOOL): HRESULT; stdcall;
(* ******************************************************************* *)
(*
* flush() tells the encoder to send everything that's in the buffer and
* clear it:
*)
function flush: HRESULT; stdcall;
(* ******************************************************************* *)
(*
* GetTime returns the current system time in milliseconds. The return
* value is a UINT32 (32-bit unsigned int):
*)
function GetTime: UINT32; stdcall;
(* ******************************************************************* *)
(*
* This must be called on a regular basis:
*)
function Process: HRESULT; stdcall;
(* ******************************************************************* *)
(*
* These methods keep track of the encoder's state and must be called
* as they are in main.cpp in the exlvtext directory:
*)
function EncoderIsInitialized: BOOL; stdcall;
function PacketsHaveStarted: BOOL; stdcall;
function EncoderIsDone: BOOL; stdcall;
function SetEncoderDone: HRESULT; stdcall;
end;
{$EXTERNALSYM IRMALiveText}
function CreateLiveText(out LiveText: IRMALiveText): PN_RESULT; stdcall;
{$EXTERNALSYM CreateLiveText}
type
FPRMCREATELIVETEXT = function (out ppLiveText: IRMALiveText): PN_RESULT; stdcall;
{$EXTERNALSYM FPRMCREATELIVETEXT}
const
IID_IRMALiveText2: TGUID = '{00001b01-0901-11d1-8b06-00a024406d59}';
{$EXTERNALSYM IID_IRMALiveText2}
type
IRMALiveText2 = interface (IUnknown)
['{00001b01-0901-11d1-8b06-00a024406d59}']
(* ******************************************************************* *)
(* The following methods are to be called prior to sending any data
* and exist as overrides to the default attributes of a RealText
* presentation. Please see the section on the <window> header tag
* in the realtext.htm in the SDK's doc directory for more information.
* Note: these are additional to the IRMALiveText methods, listed
* above.
*)
(* This allows you to give an estimate of the bit rate needed by a live
* text stream so that the server can determine whether or not a player
* can view the stream based on its available bandwidth This method
* should be called before sending any data::
*)
function DeclareAverageBitrate(ulAvgBitsPerSecond: ULONG32): HRESULT; stdcall;
(* As above, for DeclareAverageBitrate, this method should be called
* before sending any data::
*)
function DeclareMaximumBitrate(ulMaxBitsPerSecond: ULONG32): HRESULT; stdcall;
(*This determines how multiple contiguous space characters are presented;
* Defaults to FALSE which means that multiple spaces in non-tag text
* would all be renderered. If this value is TRUE, multiple contiguous
* spaces will be treated as a single space. This method should be
* called before sending any data.
*)
function IgnoreExtraSpaces(bIgnoreExtraSpaces: BOOL): HRESULT; stdcall;
(* This is for internal testing use only and does not affect the
* presentation of a live text stream:
*)
function SetFlags(ulFlags: ULONG32): HRESULT; stdcall;
(* ******************************************************************* *)
(* The following methods can be called at any time while the encoder is
* running.
*)
(* This method tells you when the last-sent text will end. This
* allows you to determine when it's ok to send more text. For example,
* if you're streaming a presentation that's scrolling at a rate of 20
* pixels per second in a window that's 200 pixels high and you call
* IRMALiveText's AddData() with 100 lines of 20-point text, it will take
* 100 seconds for all that text to scroll up and out of the window. The
* following method would return the current time plus 100 if you called
* it right after calling AddData():
*)
function GetLastSentTextEndTime(var ulLastEndTime: ULONG32): HRESULT; stdcall;
(* This method allows you to adjust the time, since the last data was
* sent, that the encoder waits before resending "heartbeat" packets that
* let the server know the encoder still alive and to let newly-connected
* players know what's currently visible in the window (in case they
* connected during a "dry" period in the stream, after the last new
* text was sent). Time is in milliseconds. NOTE: this defaults to
* 3000 milliseconds; any number higher than this will result in longer
* connect times for players coming in during a "dry" spell in the
* stream, and a sufficiently high value may cause the server to
* disconnect since it assumes the encoder has stopped if it does not
* periodically send data. This value's minimum is 500 milliseconds.
*)
function SetTimeBetweenDryStreamResends(ulMillisecBetweenResends: ULONG32): HRESULT; stdcall;
end;
{$EXTERNALSYM IRMALiveText2}
implementation
function CreateLiveText; external 'TODO' name 'CreateLiveText';
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -