The RealPix broadcast feature lets you stream "live" RealPix presentations over a network. You can use it, for example, to broadcast JPEG images captured at regular intervals by a camera. To set up a RealPix broadcast, you create a broadcast application that adds RealPix mark-up to streaming images. You then integrate the broadcast application with the RealPix Broadcast Library through a single system interface. That library takes care of the overhead of integrating with the standard RealSystem Remote Broadcast Library and a RealSystem broadcast plug-in, which manages the connection to RealServer.
![]() |
Additional Information |
---|
For information on RealPix mark-up, see RealPix Authoring Guide, available from http://service.real.com/help/library/index.html. The bundled HTML download of this manual contains a compiled application that you can use to broadcast RealPix. You need to build a new application with this SDK only if that application does not fit your needs. |
The following table lists the components you use to broadcast LiveRealPix with RealSystem. These components are included with a RealServer G2 installation.
Suppose that the live broadcast has the following URL:
rtsp://www.real.com/encoder/image
When the broadcast begins, the broadcast application connects to the LiveRealPix Broadcast Library, passing it the name of the live broadcast "file" (image), as well as identifying which broadcast plug-in to use. When the first client requests the live feed, RealServer determines which broadcast plug-in to use based on the URL's mount point (/encoder/). RealServer's FSMount
configuration parameter ties the mount point to a specific broadcast plug-in.
![]() |
Additional Information |
---|
See "FSMount Parameter". |
The LiveRealPix broadcast application uses the following interfaces:
IRMALiveRealPix
. Header file: rmalvpix.h
. The LiveRealPix Broadcast Library implements this interface. The broadcast application uses this interface to send initialization parameters, images, effects, and mark-up to the library.
IRMALiveRealPixResponse.
Header file: rmalvpix.h
. The LiveRealPix Broadcast Library also implements this interface, and uses it to respond to various IRMALiveRealPix
methods.
The following sections explain how the RealPix broadcast application interacts with the LiveRealPix Broadcast Library. The sample file included with this SDK illustrates many of these features. You can use the sample file as a starting point for building your own broadcast application.
When a LiveRealPix broadcast application starts up, it performs these actions:
CreateLiveRealPix
process address, as shown in this extract from the sample file:
FPRMCREATELIVEREALPIX fpCreateLiveRealPix = (FPRMCREATELIVEREALPIX) GetProcAddress(hRPLiveDLL, "CreateLiveRealPix");
IRMALiveRealPix
interface:
IRMALiveRealPix
*pLiveRealPix = NULL;
PN_RESULT retVal = fpCreateLiveRealPix(&pLiveRealPix);
IRMALiveRealPix
methods return responses, the application must also create an instance of the IRMALiveRealPixResponse
interface:
IRMALiveRealPixResponse
*pLiveRealPixResponse = NULL;
PN_RESULT retVal = fpCreateLiveRealPixResponse(&pLiveRealPixResponse);
IRMALiveRealPix::StartEncoder
to pass the broadcast library a pointer to the the IRMALiveRealPixResponse
interface, along with a PixInitInfo
structure containing the following parameters:
IRMALiveRealPix::Process
to give the library time to initialize. The library returns a value indicating whether the initialization was successful.
After initializing the LiveRealPix Broadcast Library, the broadcast application passes images to the library, which then creates the RealSystem packets transmitted by the broadcast plug-in. The broadcast application uses the following IRMALiveRealPix
methods to pass the images:
IRMALiveRealPix::InitImage
Prepares an image for sending. It passes the live pix object a PixImageInfo
structure containing the following parameters:
ImageBuffer |
Buffer holding image data. |
ImageBufferSize |
Size of image buffer. |
ImageCodec |
image codec to be used. |
IRMALiveRealPix::InitImage
returns several useful pieces of information (also on the PixImageInfo
structure):
Handle |
The handle of the image, used in IRMALiveRealPix::SendImage . |
NumPackets |
The number of packets this image will comprise. |
TimeToSend |
Time in milliseconds required to send the image. |
Remember that IRMALiveRealPix::InitImage
simply breaks the image up into packets, and does not send anything to the server. Note also that IRMALiveRealPix::InitImage
is not an asynchronous callall processing has finished by the time this call returns.
IRMALiveRealPix::SendImage
Tranfers all the image's packets (the image referenced by the handle returned by IRMALiveRealPix::InitImage
into the packet send queue. Subsequent calls to IRMALiveRealPix::Process
will cause these packets to be sent to the RealServer.
When all the packets for this image have been sent, the encoder will respond with IRMALiveRealPixResponse::ImageSent
.
IRMALiveRealPix::SendEffect
Creates an effect packet with the information contained in the PixEffectInfo
structure and immediately adds this packet to the packet send queue. Further calls to IRMALiveRealPix::Process
result in this packet being sent to the server. A handle is returned in the PixEffectInfo
structure by which this effect can later be identified.
Parameter | Defines |
---|---|
EffectType |
Effect Type: EFFECT_FILL, EFFECT_FADEIN , etc. See rmalvpix.h for more information. |
Start |
Start time in milliseconds for the effect. |
Duration |
Duration in milliseconds for the effect. |
Target |
Handle of image to perform effect on (returned by IRMALiveRealPix::InitImage ) |
SrcX |
Horizontal offset of source rectangle. This parameter, and the three `source' parameters that follow, can be used to display just a portion of the original image. To display the entire image, set these all to 0. |
SrcY |
Vertical offset of source rectangle. |
SrcW |
Width of source rectangle. |
SrcH |
Height of source rectangle. |
DstX |
Horizontal offset of destination rectangle. This parameter, and the three `destination' parameters that follow, are used to position and size the image in the presentation space. |
DstY |
Vertical offset of destination rectangle. |
DstW |
Width of destination rectangle. |
DstH |
Height of destination rectangle. |
MaxFps |
Maximum frames per second for this effect. |
AspectFlag |
TRUE to preserve aspect ratio on this effect. |
Red |
Red component of fill or fadeout color. |
Green |
Green component of fill or fadeout color. |
Blue |
Blue component of fill or fadeout color. |
WipeDirection |
WIPE_DIRECTION_xxx , where xxx is UP , DOWN , LEFT , or RIGHT . |
WipeType |
WIPE_TYPE_NORMAL or WIPE_TYPE_PUSH. |
URL |
URL to send the client to when the image is clicked. |
ExtPackage |
Name of external effect package. For an example of an external effect package, see pxexfx in the / directory of the SDK. External effect packages will be documented more fully in a future release of this SDK. |
ExtName |
Name of external effect within the package. |
ExtData |
Opaque string data for external effect. |
ExtFile |
File contents of external effect data. |
DiscardImage |
TRUE to discard image after doing effect |
DisplayImmediately |
FALSE to obey start time; TRUE to do effect immediately. |
Handle |
Handle by which effect can be referenced (returned by IRMALiveRealPix::SendEffect ). |
When the effect has been sent to the server, the encoder will respond with IRMALiveRealPixResponse::EffectSent
.
IRMALiveRealPix::GetTime
Returns the time in milliseconds since the encoder library was initialized. This value can be used in conjunction with the Start
effect parameter and the TimeToSend
parameter returned by IRMALiveRealPix::InitImage
to control the timing of the presentation.
IRMALiveRealPix::Process
Must be called to give the library time to send packets to the server. It should be called frequently between IRMALiveRealPix::SendImage
and IRMALiveRealPixResponse::ImageSent
, as well as between IRMALiveRealPix::SendEffect
and IRMALiveRealPixResponse::EffectSent
. At all other times, it should be called every 3 to 5 seconds.
When designing your LiveRealPix broadcast application, keep the following points in mind:
IRMALiveRealPix::SendImage
does not cause an image to be displayed; IRMALiveRealPix::SendEffect
does this. You can send several images to the client in advance, then control the placement and timing of the display using IRMALiveRealPix::SendEffect.
IRMALiveRealPix::SendEffect
can do more than just display an image. For instance, to change the target URL for an image already displayed, you send a fade-in effect with a duration of 0 and the new URL, and the link changes without any visible effect.
When the broadcast application is done sending images to the broadcast library, it calls IRMALiveRealPix::StopEncoder,
which causes the library to shut down the connection with the RealServer.
The encoder will respond with IRMALiveRealPixResponse::EncoderStopped
.
Interfaces to the RealText Broadcast Library are defined in rmalvpix.h
. Sample code for a LiveRealPix application that uses the library is provided in:
This simple LiveRealPix broadcast application loads the LiveRealPix Library, initializes it with some passed-in arguments, then sends an image from a file on disk, along with a fade-in effect. It then watches the file for changes to its size or last modification time, and resends the image, using IRMALiveRealPix::SendImage
whenever it detects a change to the file. It also sends a fade-in effect, which causes the image just sent to display. The application calls IRMALiveRealPix::Process
frequently to give processor time to the Broadcast Library.
![]() |
Additional Information |
---|
RealPix Authoring Guide, which is available at http://service.real.com/help/library/index.html . |
Carry out the following steps to modify the sample code and implement remote broadcasting for your application:
PATH
(LD_LIBRARY_PATH
for UNIX). These libraries are listed in the table "LiveRealPix Broadcast Components".
pLiveRealPix->StartEncoder(&cInitInfo, this)
where cInitInfo
is a structure of the type PixInitInfo
. See rmalvpix.h
for more information.
IRMALiveRealPix::Process
frequently to allow the library to perform its necessary processing.
LoadLibrary
as shown in exlivpix.cpp.
![]() |
Additional Information |
---|
See "Compiling a Plug-In". |
Do the following to test broadcasting with your application:
FSMount
parameter to specify the broadcast plug-in's mount point, short name, port, and, optionally, password. If the parameter does not specify a password, passwords passed to the broadcast library are ignored and any broadcast application can connect to the plug-in.
![]() |
Additional Information |
---|
See "FSMount Parameter". |
Start the broadcast application, connecting it to the port defined in the plug-in's FSMount
parameter. The following example shows how to do this from the command line for an application connecting to RealServer port 7072 and broadcasting a file named image (the syntax may differ for your application):
% exlivpix rmaserver.site.com 7072 <user name
> <password
> image
rtsp://serverhost.domain.com/mountpoint/filename
For example, with the image broadcast example above, the URL would be:
rtsp://rmaserver.site.com/encoder/image
RealPlayer should buffer then play the broadcast. The scrollbar is disabled when RealPlayer receives live content.