To stream your datatype from a live source, you can use RealSystem's remote broadcast feature, which ties a broadcast application into the standard RealSystem broadcast plug-in. If this feature does not provide the required functionality, however, you can build your own broadcast plug-in to stream live content to clients. Live content can come from an encoder or other digital source on a network, or else directly from digitizing hardware on the server computer.
As shown in the next figure, a broadcast plug-in creates two objects used by RealServer. RealServer uses the file object to verify URL requests to the broadcast. It uses the broadcast object to get the packets. The broadcast plug-in can use Network Services to communicate with the live source over a TCP/IP network. If the live content is created locally in hardware, the plug-in communicates directly with the hardware.
![]() |
Additional Information |
---|
"Chapter 14: Network Services". |
![]() |
Note |
---|
Because it delivers packets to RealServer, the broadcast plug-in performs the functions of both a file system plug-in and a file format plug-in. |
A broadcast plug-in typically implements the following interfaces:
IRMAPlugin
. Header file: rmaplugn.h
. Every plug-in implements this interface, which RealServer uses to determine the plug-in's characteristics.
IRMABroadcastFormatObject
. Header file: rmaformt.h
. A broadcast plug-in must implement this interface, which provides the basic methods that RealServer uses to instruct the plug-in to send it file headers and packets. The response interface is IRMAFormatResponse
, the same response interface used by a file format plug-in.
IRMAFileSystemObject
. Header file: rmafiles.h
. RealServer uses this interface to create a file object that validates requests to join the live broadcast.
IRMAFileExists
. Header file: rmafiles.h
. RealServer uses this interface to verify that the broadcast source for a URL request exists.
IRMABroadcastMapper
. Header file: rmafiles.h
. RealServer uses this interface to discover the type of file system provided by the plug-in and to get the plug-in's file system short name.
IRMACallback
. Header file: rmaengin.h
. If the plug-in uses IRMAScheduler
, it implements this interface to receive Scheduler callbacks at designated intervals.
IRMARequestHandler
. Header file: rmafiles.h
. The broadcast object can implement this interface to access the broadcast response headers.
The following sections explain how RealServer and a broadcast plug-in use the RealSystem interfaces to stream data to a client. The sample files included with this SDK illustrate many of these features. You can use these sample files as a starting point for building your own plug-in. Refer to the RealSystem SDK header files for more information on function variables and return values.
When RealServer starts up, it loads each broadcast plug-in:
RMACreateInstance
to create an instance of an IRMABroadcastFormatObject
interface. See "Creating a Plug-In Instance" for more on this method.
IRMAPlugin::GetPluginInfo
, which returns descriptive information about the plug-in, including its copyright and "more information" URL. The bLoadMultiple
attribute must be set to FALSE to ensure that all clients can connect to the same global broadcast object.
IRMABroadcastFormatObject::GetBroadcastFormatInfo
, which returns the plug-in short name, a unique string that identifies the plug-in and is used in RealServer's FSMount
configuration parameter.
![]() |
Additional Information |
---|
See "FSMount Parameter". |
IRMAFileSystemObject::GetFileSystemInfo
, which also returns the plug-in short name. The plug-in can return any value for the protocol variable, which is used only when RealPlayer plays from its local file system and is ignored for broadcast plug-ins.
When RealServer receives the first request for a live feed, it selects the broadcast plug-in based on the requested URL's mount point. The FSMount
configuration parameter associates plug-ins with URL mount points. (See"File Handling Overview".) RealServer then initializes the plug-in:
IRMAPlugin::InitPlugin
method, passing it a pointer to the system context. The plug-in then initializes a broadcast object from the context. For example:
if(!g_example_broadcast_format)
{
// Initialize the global object
g_example_broadcast_format = new ExampleBroadcastFormat(pContext);
// Set our local pointer to the context in case this instance gets
// used for anything else
m_pContext = pContext;
m_pContext-AddRef()
;
}
The global broadcast object exists until the live stream terminates, whether or not any clients are connected to it.
IRMABroadcastFormatObject::InitBroadcastFormat
, passing the broadcast plug-in a pointer to the live stream URL. RealServer also sets itself up as the broadcast response object that receives notification of plug-in actions through IRMAFormatResponse
.
The plug-in should use the context pointer to store a reference to IRMACommonClassFactory
for later use. It should also use the context pointer to query for IRMAScheduler
if it will use the Scheduler to receive callbacks.
![]() |
Additional Information |
---|
See "Using the Scheduler". |
PNR_OK
through IRMAFormatResponse::InitDone
.
![]() |
Additional Information |
---|
See "Status Codes". |
IRMAFileSystemObject::InitFileSystem
. The plug-in should return the status code PNR_OK
.
Each time a client requests a connection to the live stream, RealServer performs the following steps to verify the connection. These are the standard steps that RealServer uses to verify the existence of any requested file. The broadcast plug-in verifies that the "file" is an available live stream. Once the client connection is validated, the file object is destroyed and the client connects to the global broadcast object.
IRMAFileSystemObject::CreateFile
to create a file object for the live broadcast. The plug-in creates an IRMAFileObject
interface, which implements these interfaces:
IRMAFileExists::DoesExist
, passing the file object a pointer to the file path. The file object uses IRMAFileExistsResponse::DoesExistDone
to return TRUE
if the path is for a valid broadcast "file." Otherwise it returns FALSE
.
IRMABroadcastMapper::FindBroadcastType
, passing the file object a pointer to the file path to determine the broadcast format. The file object returns a status code and the broadcast plug-in short name through IRMABroadcastMapperResponse::BroadcastTypeFound
.
![]() |
Additional Information |
---|
See "Status Codes". |
IRMABroadcastFormatObject::GetFileHeader
to get the source header data. The plug-in retrieves the stream count and any opaque data it needs to send its rendering plug-ins, encapsulating this information in an IRMAValues
interface and calling IRMAFormatResponse::FileHeaderReady
to pass RealServer a status code and a pointer to the values interface.
After sending RealServer the file header for the requested URL, the broadcast plug-in sends it the stream headers for each stream:
IRMABroadcastFormatObject::GetStreamHeader
.
IRMABuffer
interface for each of the following:
Stream Name
. The stream name, which appears in the RealPlayer window, identifies the stream to the user.
Stream MIME type
. The stream MIME type identifies the stream to the browser. For example:
application/x-pn-livestream
Opaque Data
. The opaque data is anything the plug-in needs to pass to its renderer.
IRMAValues
interface that points to the buffer interfaces and that contains the standard stream header properties.
![]() |
Additional Information |
---|
See "Creating Stream Headers". See also "Timing and Synchronization" for information on stream start times, preroll, and so on. |
IRMAFormatResponse::StreamHeaderReady
to pass RealServer a status code and a pointer to the IRMAValues
stream header object. It then uses IUnknown::Release
to release the buffer and values interfaces.
![]() |
Additional Information |
---|
See "Status Codes". |
IRMAASMSource::Subscribe
method to subscribe to all rules. The broadcast plug-in therefore just sends all packets for all ASM rules to RealServer, which determines which packets to stream to which clients based on each client's rule subscription.
![]() |
Additional Information |
---|
"Chapter 11: Adaptive Stream Management". |
After receiving the stream header or headers, RealServer requests packets for each live stream. This step is similar to packet creation in a file format plug-in, described in "Creating Stream Packets".
IRMABroadcastFormatObject::StartPackets
method to start the stream of packets.
IRMAPacket
objects that contain the opaque data passed to the renderer, as well as values for the RealSystem stream properties. The plug-in typically sends packets to RealServer at regular intervals, prompted to do so by the Scheduler.
![]() |
Additional Information |
---|
See the table "Stream Packet Properties". See "Using IRMAPacket to Create Stream Packets" for the basics of packet creation. See "Using the Scheduler" for information on receiving callbacks. |
IRMABroadcastFormatObject::StopPackets
or until the stream source stops, at which point the plug-in calls IRMAFormatResponse::StreamDone
.
A broadcast plug-in should generally create packets of 430 to 500 bytes for the opaque data. Staying under 500 bytes decreases the likelihood of packet fragmentation. RealNetworks also recommends that you write code that lets you quickly change the size of the packets the plug-in sends.
You can use the sample broadcast plug-in as a starting point for building your own plug-in:
/samples/intermed/exlivpln/exlivpln.cpp
This sample file stores the context. For most uses, you do not need to modify this file.
/samples/intermed/exlivpln/
exlivobj.cpp
You need to create one broadcast object for each stream being broadcast. Perform the following steps to modify the sample code:
zm_pDescription
, zm_pCopyright
, and zm_pMoreInfoURL
.
ExampleBroadcastObject::GetStreamHeader
to match the type of data in the stream. The stream MIME type determines which rendering plug-in is loaded to play that stream.
IRMANetworkServices
interface to open a connection to the live data source. The example code does not currently demonstrate how to use Network Services.
![]() |
Additional Information |
---|
See "Chapter 14: Network Services". |
ExampleBroadcastObject::StartPackets
.
FSMount
parameter.
![]() |
Additional Information |
---|
See "FSMount Parameter". |
![]() |
Additional Information |
---|
See "Compiling a Plug-In". |