previous next

Chapter 18: RealPix Broadcast

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.

LiveRealPix Broadcast Components
Component On Windows On UNIX
LiveRealPix Broadcast Library pxli3260.dll rplive.so.6.0
Remote Broadcast Library encn3260.dll encnet.so.6.0
Broadcast Plug-In (short name: pn-encoder) enco3260.dll encoplin.so.0.1

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".

Interfaces

The LiveRealPix broadcast application uses the following interfaces:

Coding the Remote Pix Broadcast Application

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.

Initializing the LiveRealPix Broadcast Library

When a LiveRealPix broadcast application starts up, it performs these actions:

  1. The application loads the LiveRealPix Broadcast Library and the Remote Broadcast Library listed in the table "LiveRealPix Broadcast Components" .

  2. The application gets the LiveRealPix library's CreateLiveRealPix process address, as shown in this extract from the sample file:
    
    FPRMCREATELIVEREALPIX fpCreateLiveRealPix = (FPRMCREATELIVEREALPIX)   GetProcAddress(hRPLiveDLL, "CreateLiveRealPix");
    

  3. The application can now create an instance of the IRMALiveRealPix interface:
    
    IRMALiveRealPix *pLiveRealPix = NULL;
    PN_RESULT retVal = fpCreateLiveRealPix(&pLiveRealPix);

  4. Since most of the IRMALiveRealPix methods return responses, the application must also create an instance of the IRMALiveRealPixResponse interface:
    
    IRMALiveRealPixResponse *pLiveRealPixResponse = NULL;
    PN_RESULT retVal = fpCreateLiveRealPixResponse(&pLiveRealPixResponse);

  5. The application uses IRMALiveRealPix::StartEncoder to pass the broadcast library a pointer to the the IRMALiveRealPixResponse interface, along with a PixInitInfo structure containing the following parameters:

    Live Pix Initialization Parameters
    Parameter Defines
    ServerAddress Host name or IP address of RealServer.
    ServerPort The server port the broadcast plug-in listens on. This plug-in's FSMount setting defines this.
    Username Name the application uses to connect to the broadcast plug-in. It should be encoder if a password is used.
    Password Password the application uses to connect to the broadcast plug-in. The plug-in's FSMount setting defines this.
    Filename The "file name" that follows the broadcast plug-in's mount point in the URL. For example, in rtsp://www.real.com/encoder/image, the broadcast plug-in has a mount point of /encoder/ and the "file name" is image.
    Title Title of image.
    Author Name of person or organization that created the image.
    Copyright Copyright information for the image.
    Bitrate Rate in Kbits per second image is to be sent.
    MaxFPS Upper limit on number of effects frames to be sent per second.
    DisplayWidth Size of presentation window width in pixels.
    DisplayHeight Size of presentation window height in pixels.
    PreserveAspect Boolean value that states whether the aspect ratio of image is to be preserved. If TRUE, the image aspect ration is preserved.
    DefaultURL Default URL to send browser to when clicked.
    NumImageCodecs Number of image codecs used in this stream.
    ImageCodec String names of codecs. The string names of codecs currently supported are "image/vndr.rn-realpix.jpeg" (for JPEG images) and "image/vnd.rn-realpix.gif" (for GIF images).
    NumEffectsPackages Number of external effect packages used.
    EffectPackage String names of effect packages.

  6. The application calls IRMALiveRealPix::Process to give the library time to initialize. The library returns a value indicating whether the initialization was successful.

Sending Images to the Library

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:

When designing your LiveRealPix broadcast application, keep the following points in mind:

Stopping the LiveRealPix Broadcast Library

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.

Modifying the RealPix Broadcast Sample Code

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:

  1. Install the broadcast libraries in a directory on your PATH (LD_LIBRARY_PATH for UNIX). These libraries are listed in the table "LiveRealPix Broadcast Components".

  2. Copy the sample code to a working directory. Change the file names to match your application name.

  3. Provide a way for your application to get the required initialization parameters, then initialize the broadcast library. For example:
    
    pLiveRealPix->StartEncoder(&cInitInfo, this)
    

    where cInitInfo is a structure of the type PixInitInfo. See rmalvpix.h for more information.

  4. Write the application-specific processing code. Be sure to call IRMALiveRealPix::Process frequently to allow the library to perform its necessary processing.

  5. Compile your application. The application does not need to link to the broadcast libraries as long as it calls LoadLibrary as shown in exlivpix.cpp.

    Additional Information
    See "Compiling a Plug-In".

Broadcasting

Do the following to test broadcasting with your application:

  1. Make sure the broadcast plug-in is installed in RealServer's plug-in directory.

  2. Edit the RealServer 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".

  3. Restart RealServer.

    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
    

  4. Debug receiving a live image stream in RealPlayer. Using File>Open Location, enter the URL for receiving the live stream. The URL should be in this form:
    
    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.

  5. Debug sending multiple streams, one of which is live, to RealPlayer. Do this by creating an SMIL file that groups one live track of your datatype with another datatype.


Copyright © 2000 RealNetworks
For technical support, please contact supportsdk@real.com.
This file last updated on 05/17/00 at 12:50:24.
previous next