1 /****************************************************************************
5 * Copyright (C) 1995-1999 RealNetworks, Inc. All rights reserved.
7 * http://www.real.com/devzone
9 * This program contains proprietary
10 * information of Progressive Networks, Inc, and is licensed
11 * subject to restrictions on use and distribution.
14 * RealPix live encoder interfaces
24 * This struct contains initialization information
25 * and is passed in in the IRMALiveRealPix::StartEncoder()
26 * method. All of the members of this struct are input variables.
28 typedef struct PNEXPORT_CLASS _PixInitInfo
30 UINT32 m_ulStructLength
; /* length in bytes of this structure */
31 char *m_pServerAddress
; /* name or ip address of server */
32 UINT32 m_ulServerPort
; /* pn-encoder port on server */
33 char *m_pUsername
; /* username for authentication on server */
34 char *m_pPassword
; /* password for authentication on server */
35 char *m_pFilename
; /* filename which clients should open */
36 char *m_pTitle
; /* title of live presentation */
37 char *m_pAuthor
; /* author of live presentation */
38 char *m_pCopyright
; /* copyright on live presentation */
39 UINT32 m_ulBitrate
; /* bitrate of realpix stream */
40 UINT32 m_ulMaxFps
; /* max frames per second of effects */
41 UINT32 m_ulDisplayWidth
; /* display width in pixels */
42 UINT32 m_ulDisplayHeight
; /* display height in pixels */
43 BOOL m_bPreserveAspect
; /* preserve aspect ratio by default? */
44 char *m_pDefaultURL
; /* default URL to send browser to when clicked */
45 UINT32 m_ulNumImageCodecs
; /* number of image codecs used in this stream */
46 char **m_ppImageCodec
; /* string names of codecs */
47 UINT32 m_ulNumEffectPackages
; /* number of external effect packages used */
48 char **m_ppEffectPackage
; /* string names of effect packages*/
55 * This struct contains all the information for images which
56 * should be sent down the stream. This struct is used in the
57 * IRMALiveRealPix::InitImage() method.
59 typedef struct PNEXPORT_CLASS _PixImageInfo
61 UINT32 m_ulStructLength
; /* Input: size of struct */
62 BYTE
*m_pImageBuffer
; /* Input: buffer holding image data */
63 UINT32 m_ulImageBufferSize
; /* Input: size of image buffer */
64 char *m_pImageCodec
; /* Input: image codec to be used */
65 UINT32 m_ulHandle
; /* Output: image handle */
66 UINT32 m_ulNumPackets
; /* Output: number of packets image will be sent */
67 UINT32 m_ulTimeToSend
; /* Output: milliseconds required to send image */
72 #define EFFECT_FADEIN 1
73 #define EFFECT_FADEOUT 2
74 #define EFFECT_CROSSFADE 3
76 #define EFFECT_VIEWCHANGE 5
77 #define EFFECT_EXTERNAL 6
78 #define EFFECT_ANIMATE 7
80 #define WIPE_DIRECTION_UP 0
81 #define WIPE_DIRECTION_DOWN 1
82 #define WIPE_DIRECTION_LEFT 2
83 #define WIPE_DIRECTION_RIGHT 3
85 #define WIPE_TYPE_NORMAL 0
86 #define WIPE_TYPE_PUSH 1
91 * This struct contains all the information about the effect which
92 * the RealPix renderer should perform. This struct is used in the
93 * IRMALiveRealPix::SendEffect() method.
95 typedef struct PNEXPORT_CLASS _PixEffectInfo
97 UINT32 m_ulStructLength
; /* Input: Length in bytes of this struct */
98 BYTE m_ucEffectType
; /* Input: Effect Type: EFFECT_FILL, EFFECT_FADEIN, etc. */
99 UINT32 m_ulStart
; /* Input: Start time in milliseconds of effect */
100 UINT32 m_ulDuration
; /* Input: Duration in milliseconds of effect */
101 UINT32 m_ulTarget
; /* Input: Handle of image to perform effect on */
102 UINT32 m_ulSrcX
; /* Input: Horizontal offset of source rectangle */
103 UINT32 m_ulSrcY
; /* Input: Vertical offset of source rectangle */
104 UINT32 m_ulSrcW
; /* Input: Width of source rectangle */
105 UINT32 m_ulSrcH
; /* Input: Height of source rectangle */
106 UINT32 m_ulDstX
; /* Input: Horizontal offset of destination rectangle */
107 UINT32 m_ulDstY
; /* Input: Vertical offset of destination rectangle */
108 UINT32 m_ulDstW
; /* Input: Width of destination rectangle */
109 UINT32 m_ulDstH
; /* Input: Height of destination rectangle */
110 UINT32 m_ulMaxFps
; /* Input: Max frames per second for this effect */
111 BOOL m_bAspectFlag
; /* Input: TRUE: preserve aspect on this effect; FALSE: don't preserve */
112 BYTE m_ucRed
; /* Input: Red component of fill or fadeout color */
113 BYTE m_ucGreen
; /* Input: Green component of fill or fadeout color */
114 BYTE m_ucBlue
; /* Input: Blue component of fill or fadeout color */
115 BYTE m_ucWipeDirection
; /* Input: WIPE_DIRECTION_xxx, where xxx is UP, DOWN, LEFT, or RIGHT */
116 BYTE m_ucWipeType
; /* Input: WIPE_TYPE_NORMAL or WIPE_TYPE_PUSH */
117 char *m_pURL
; /* Input: URL for this effect */
118 char *m_pExtPackage
; /* Input: Name of external effect package */
119 char *m_pExtName
; /* Input: Name of external effect within the package */
120 char *m_pExtData
; /* Input Opaque string data for external effect */
121 char *m_pExtFile
; /* Input: File contents of external effect data */
122 BOOL m_bDiscardImage
; /* Input: TRUE: discard image after doing effect; FALSE: don't discard */
123 BOOL m_bDisplayImmediately
; /* Input: FALSE: obey start time; TRUE: do effect immediately */
124 UINT32 m_ulHandle
; /* Output: Handle by which effect will be referred to */
129 * Forward declarations of some interfaces defined here.
131 typedef _INTERFACE IRMALiveRealPix IRMALiveRealPix
;
132 typedef _INTERFACE IRMALiveRealPixResponse IRMALiveRealPixResponse
;
133 typedef _INTERFACE IRMALiveRealPixResend IRMALiveRealPixResend
;
136 * Forward declarations of interfaces used here
138 typedef _INTERFACE IRMAValues IRMAValues
;
141 * Declaration of the DLL entry point
143 STDAPI
CreateLiveRealPix(IRMALiveRealPix
**);
145 typedef PN_RESULT (PNEXPORT_PTR FPRMCREATELIVEREALPIX
)(IRMALiveRealPix
**ppLiveRealPix
);
147 /****************************************************************************
155 * Asynchronous interface that allows an application to encode live RealPix
157 * IID_IRMALiveRealPix:
159 * {E7ADF466-477D-11d2-AA0C-0060972D23A7}
162 DEFINE_GUID(IID_IRMALiveRealPix
, 0xe7adf466, 0x477d, 0x11d2, 0xaa, 0xc, 0x0,
163 0x60, 0x97, 0x2d, 0x23, 0xa7);
166 #define INTERFACE IRMALiveRealPix
168 DECLARE_INTERFACE_(IRMALiveRealPix
, IUnknown
)
173 STDMETHOD(QueryInterface
) (THIS_ REFIID riid
, void **ppvObj
) PURE
;
175 STDMETHOD_(ULONG
,AddRef
) (THIS
) PURE
;
177 STDMETHOD_(ULONG
,Release
) (THIS
) PURE
;
180 * IRMALiveRealPix methods
184 * StartEncoder() must be called before anything else and a pointer to
185 * an IRMALiveRealPixResponse interface must be passed in. The encoder will
186 * respond to this call asynchronously with IRMALiveRealPixResponse::EncoderStarted().
188 STDMETHOD(StartEncoder
) (THIS_ PixInitInfo
*pInitInfo
,
189 IRMALiveRealPixResponse
*pResponse
) PURE
;
192 * InitImage() is called to prep an image for being sent. It returns several useful
193 * pieces of information which the caller can make use of: the handle to refer to
194 * the image in SendImage(), the number of packets this image will be broken up into,
195 * and the time required to send this image in milliseconds. Note that InitImage()
196 * simply breaks the image up into packets - nothing has been sent to the server yet.
197 * This is not an asynchronous call - all processing has finished by the time this
200 STDMETHOD(InitImage
) (THIS_ PixImageInfo
*pImageInfo
) PURE
;
203 * SendImage() tranfers the all the packets for the image referred to by ulImageHandle
204 * into the packet send queue. Further calls to Process() will result in these
205 * packets being sent to the RealServer. When all the packets for this image have
206 * been sent, the encoder will respond with IRMALiveRealPixResponse::ImageSent().
208 STDMETHOD(SendImage
) (THIS_ UINT32 ulImageHandle
) PURE
;
211 * SendEffect() creates an effect packet with the information contained in
212 * the PixEffectInfo struct and immediately adds this packet to the packet
213 * send queue. Further calls to Process() will result in this packet being
214 * sent to the server. A handle is returned in the PixEffectInfo struct by
215 * which this effect can later be identified. When the effect has been
216 * sent to the server, the encoder will respond with
217 * IRMALiveRealPixResponse::EffectSent().
219 STDMETHOD(SendEffect
) (THIS_ PixEffectInfo
*pEffectInfo
) PURE
;
222 * StopEncoder() may be called at any time after calling StartEncoder().
223 * This tells the encoder that no more images of effects are going to
224 * be sent to the encoder. The encoder shuts down the connection to
225 * the server and responds with IRMALiveRealPixResponse::EncoderStopped().
227 STDMETHOD(StopEncoder
) (THIS
) PURE
;
230 * GetTime() returns the time in milliseconds since the encoder library was initialized.
232 STDMETHOD_(UINT32
, GetTime
) (THIS
) PURE
;
235 * Process() must be called in order to give the library time to send
236 * packets to the server. It should be called very often in between SendImage()
237 * and ImageSent(), as well as between SendEffect() and EffectSent(). Other
238 * that these times, it should be called every 3-5 seconds.
240 STDMETHOD(Process
) (THIS
) PURE
;
243 /****************************************************************************
247 * IRMALiveRealPixResponse
251 * Asynchronous response interface that allows an application to
252 * encode live RealPix
254 * IID_IRMALiveRealPixResponse:
256 * {E7ADF46C-477D-11d2-AA0C-0060972D23A7}
259 DEFINE_GUID(IID_IRMALiveRealPixResponse
, 0xe7adf46c, 0x477d, 0x11d2, 0xaa, 0xc, 0x0,
260 0x60, 0x97, 0x2d, 0x23, 0xa7);
264 #define INTERFACE IRMALiveRealPixResponse
266 DECLARE_INTERFACE_(IRMALiveRealPixResponse
, IUnknown
)
271 STDMETHOD(QueryInterface
) (THIS_ REFIID riid
, void **ppvObj
) PURE
;
273 STDMETHOD_(ULONG
,AddRef
) (THIS
) PURE
;
275 STDMETHOD_(ULONG
,Release
) (THIS
) PURE
;
278 * IRMALiveRealPixResponse methods
282 * EncoderStarted() is the asynchronous response to StartEncoder(). The status
283 * argument tells whether initializing the server was successful or not, and the pszHeaderString
284 * argument returns the text string returned by the RealServer.
286 STDMETHOD(EncoderStarted
) (THIS_ PN_RESULT status
, const char *pszHeaderString
) PURE
;
289 * ImageSent() is the asynchronous response to SendImage(). The ulImageHandle argument
290 * identifies which image has just completed sending to the server, and the status
291 * argument tells whether or not the send was successful or not.
293 STDMETHOD(ImageSent
) (THIS_ PN_RESULT status
, UINT32 ulImageHandle
) PURE
;
296 * EffectSent() is the asynchronous response to SendEffect(). The ulEffectHandle argument
297 * identifies which effect has just completed sending to the server, and the status
298 * argument tells whether or not the send was successful or not.
300 STDMETHOD(EffectSent
) (THIS_ PN_RESULT status
, UINT32 ulEffectHandle
) PURE
;
303 * EncoderStopped() is the asynchronous response to StopEncoder(). The status
304 * argument tells whether or not the stopping of the encoder was successful.
305 * If the status is PNR_OK, then the application can then shut down or turn
306 * around and call StartEncoder() again.
308 STDMETHOD(EncoderStopped
) (THIS_ PN_RESULT status
) PURE
;
311 * ErrorOccurred() is called when the encoder receives an error from the RealServer.
312 * Depending upon the severity of the error, the RealServer may then shut down
313 * the encoder and an EncoderStopped() call would be made. Therefore, the
314 * application should be ready to handle an EncoderStopped() call at any time.
315 * If an error occurs, it's probably a good idea to call StopEncoder() and shut
316 * down the encoder from the application side anyway.
318 STDMETHOD(ErrorOccurred
) (THIS_
const UINT8 unSeverity
,
319 const ULONG32 ulRMACode
,
320 const ULONG32 ulUserCode
,
321 const char *pszUserString
,
322 const char *pszMoreInfoURL
) PURE
;
325 /****************************************************************************
329 * IRMALiveRealPixResend
333 * Allows re-sending and releasing of images with IRMALiveRealPix
335 * IID_IRMALiveRealPixResend:
337 * {D814DA11-8B02-11D3-8AF3-00C0F030B4E5}
339 DEFINE_GUID(IID_IRMALiveRealPixResend
, 0xd814da11, 0x8b02, 0x11d3, 0x8a, 0xfe, 0x0,
340 0xc0, 0xf0, 0x30, 0xb4, 0xe5);
344 #define INTERFACE IRMALiveRealPixResend
346 DECLARE_INTERFACE_(IRMALiveRealPixResend
, IUnknown
)
351 STDMETHOD(QueryInterface
) (THIS_ REFIID riid
, void** ppvObj
) PURE
;
353 STDMETHOD_(ULONG
,AddRef
) (THIS
) PURE
;
355 STDMETHOD_(ULONG
,Release
) (THIS
) PURE
;
358 * IRMALiveRealPixResend methods
362 * InitResend() informs the encoder that from now on, after an
363 * image is sent with SendImage() it should not be discarded
364 * but held in the encoder until ReleaseImage() is called().
366 STDMETHOD(InitResend
) (THIS_ IRMAValues
* pOptions
) PURE
;
369 * ReleaseImage() informs the encoder that the application no longer
370 * intends to call SendImage() on the image referenced by ulImageHandle
371 * and that it can discard the image. Further calls to SendImage(x) will
372 * return PNR_UNKNOWN_IMAGE after ReleaseImage(x) has been called.
373 * ReleaseImage(x) will return PNR_UNKNOWN_IMAGE if x is an unknown handle.
375 STDMETHOD(ReleaseImage
) (THIS_ UINT32 ulImageHandle
) PURE
;
378 * DumpAllQueuedPackets() clears any packets currently waiting to be
379 * sent to the server. These packets were put on the send queue by
380 * either IRMALiveRealPix::SendImage() or IRMALiveRealPix::SendEffect().
382 STDMETHOD(DumpAllQueuedPackets
) (THIS
) PURE
;