RealityServer Web Services API Programmer's Manual

mi::rswservices::IRtmp_context Class Reference

[RTMP]

Description

Provides information and managements functionality for the RTMP connection. This class will available as the attachment "rtmp_context" if the executing code was triggered from an RTMP RPC request. This is typically commands executing over an RTMP connection.

Note:

Public Member Functions

virtual mi::Sint32 create_encoder( const char* name, const char* codec, const char* render_loop_name, const char* public_pool = NULL) =0
Creates an RTMP encoder for this connection. More...
virtual mi::Sint32 create_render_loop( const char* name, const char* scene_name, const char* scope_name, const char* render_handler_name, const char* public_pool = NULL) =0
Creates an RTMP render loop. More...
virtual const char* get_connection_id() const =0
Returns the connection id of this connection.
virtual const char* get_connection_property( const char* key) const =0
Gets a property from the connection. More...
virtual const IMapget_connection_statistics() const =0
Returns the connection statistics.
virtual IRtmp_stream_encoderget_encoder( const char* name) const =0
Retrieves a previously created encoder. More...
virtual const IRtmp_codec_infoget_registered_codec( mi::Uint32 index) const =0
Returns the format name of a registered video codec. More...
virtual const char* get_registered_render_handler( mi::Uint32 index) const =0
Returns the name of a registered render handler. More...
virtual IRtmp_render_loopget_render_loop( const char* name, const char* public_pool = NULL) const =0
Retrieves an RTMP render loop. More...
virtual mi::Sint32 remove_encoder( const char* name) =0
Remove an encoder. More...
virtual mi::Sint32 remove_render_loop( const char* name, const char* public_pool = NULL) =0
Removes an RTMP render loop. More...
virtual mi::Sint32 remove_render_loop_pool( const char* public_pool) =0
Removes an entire public pool of RTMP render loops. More...
virtual Sint32 set_connection_property( const char* key, const char* value) =0
Sets a property on the connection. More...

Member Functions

virtual mi::Sint32 mi::​rswservices::​IRtmp_context::create_encoder( const char* name, const char* codec, const char* render_loop_name, const char* public_pool = NULL) [pure virtual]

Creates an RTMP encoder for this connection. RTMP encoders associate a render context with a video encoder. Unlike render contexts each stream must have it's own encoder, they cannot be shared.

Parameters

name
the name of the encoder to create. Pass this name into NetStream.play() to use the encoder.
codec
the codec to use to encode the stream. Available codecs can be discovered using get_registered_codec. If NULL or "default" then use the default codec.
render_loop_name
the name of the render loop to use.
public_pool
the pool in which to find the render_context_name if it is a public context.

Returns

  • mi::nservices::NRS_ERROR_NONE : success
  • mi::nservices::NRS_ERROR_MEMORY : out of memory
  • mi::nservices::NRS_ERROR_INVALID_PARAMETERS : a parameter is null or an empty string or public_pool is an empty string.
  • mi::nservices::NRS_ERROR_INVALID_OPERATION : render_context_name is not a known rtmp render handler.
  • mi::nservices::NRS_ERROR_NOT_FOUND : codec does not have an encoding plugin installed. If codec was NULL then no default codec was available.
  • mi::nservices::NRS_ERROR_FAILED : an encoder is already registered as name.
  • mi::nservices::NRS_ERROR_NEURAY : internal error.

virtual mi::Sint32 mi::​rswservices::​IRtmp_context::create_render_loop( const char* name, const char* scene_name, const char* scope_name, const char* render_handler_name, const char* public_pool = NULL) [pure virtual]

Creates an RTMP render loop. Render loops are used to provide rendered images to RTMP streams. A single render loop can be shared by multiple streams, even from different connections.

Parameters

name
the name of the render loop to create.
scene_name
the name of the scene to render in this render loop.
scope_name
the name of the scope to render in, pass NULL or an empty string to use the global scope.
render_handler_name
the name of the render handler to be used by this loop. Available render handlers can be discovered using get_registered_render_handler.
public_pool
if NULL then the render loop will only be available to this connection. If a string is provided then the render loop will be made available to any RTMP connection that requests it using the same name and public_pool.

Returns

  • mi::nservices::NRS_ERROR_NONE : success
  • mi::nservices::NRS_ERROR_MEMORY : out of memory
  • mi::nservices::NRS_ERROR_INVALID_PARAMETERS : a 'name' parameter is null or an empty string or public_pool is an empty string.
  • mi::nservices::NRS_ERROR_INVALID_OPERATION: a render loop already exists under name.
  • mi::nservices::NRS_ERROR_NOT_FOUND : render_handler_name is not a registered rtmp render handler.
  • mi::nservices::NRS_ERROR_FAILED : internal error.

virtual const char* mi::​rswservices::​IRtmp_context::get_connection_id() const [pure virtual]

Returns the connection id of this connection.

virtual const char* mi::​rswservices::​IRtmp_context::get_connection_property( const char* key) const [pure virtual]

Gets a property from the connection.

Parameters

key
The key to obtain the value for.

Returns

The value of the property or NULL if it does not exist.

virtual const IMap* mi::​rswservices::​IRtmp_context::get_connection_statistics() const [pure virtual]

Returns the connection statistics.

virtual IRtmp_stream_encoder* mi::​rswservices::​IRtmp_context::get_encoder( const char* name) const [pure virtual]

Retrieves a previously created encoder.

Parameters

name
the encoder to retrieve.

Returns

the encoder or NULL if none registered as name .

virtual const IRtmp_codec_info* mi::​rswservices::​IRtmp_context::get_registered_codec( mi::Uint32 index) const [pure virtual]

Returns the format name of a registered video codec.

Parameters

index
the index of the codec to return.

Returns

the format name or NULL if index is greater than the number of registered codecs.

virtual const char* mi::​rswservices::​IRtmp_context::get_registered_render_handler( mi::Uint32 index) const [pure virtual]

Returns the name of a registered render handler.

Parameters

index
the index of the render handler to return.

Returns

the handler name or NULL if index is greater than the number of registered handlers.

virtual IRtmp_render_loop* mi::​rswservices::​IRtmp_context::get_render_loop( const char* name, const char* public_pool = NULL) const [pure virtual]

Retrieves an RTMP render loop.

Parameters

name
the name of the render loop to retrieve.
public_pool
retrieve a public render loop from the given public pool of loops.

Returns

the render loop or NULL if none exists under name and public_pool .

virtual mi::Sint32 mi::​rswservices::​IRtmp_context::remove_encoder( const char* name) [pure virtual]

Remove an encoder.

Parameters

name
the encoder name

Returns

  • mi::nservices::NRS_ERROR_NONE : success
  • mi::nservices::NRS_ERROR_INVALID_PARAMETERS : name is null or an empty string
  • mi::nservices::NRS_ERROR_NOT_FOUND: name is not a known encoder
  • mi::nservices::NRS_ERROR_NEURAY : internal error.

virtual mi::Sint32 mi::​rswservices::​IRtmp_context::remove_render_loop( const char* name, const char* public_pool = NULL) [pure virtual]

Removes an RTMP render loop.

Parameters

name
the name of the render to remove.
public_pool
the public pool to remove it from.

Returns

  • mi::nservices::NRS_ERROR_NONE : success
  • mi::nservices::NRS_ERROR_INVALID_PARAMETERS : name is null or an empty string or public_pool is an empty string
  • mi::nservices::NRS_ERROR_NOT_FOUND: name is not a known render context

virtual mi::Sint32 mi::​rswservices::​IRtmp_context::remove_render_loop_pool( const char* public_pool) [pure virtual]

Removes an entire public pool of RTMP render loops.

Parameters

public_pool
the pool to remove.

Returns

  • mi::nservices::NRS_ERROR_NONE : success
  • mi::nservices::NRS_ERROR_INVALID_PARAMETERS : public_pool is null or an empty string
  • mi::nservices::NRS_ERROR_NOT_FOUND: public_pool is not a known render context pool.

virtual Sint32 mi::​rswservices::​IRtmp_context::set_connection_property( const char* key, const char* value) [pure virtual]

Sets a property on the connection.

Parameters

key
The key to set the value for.
value
The value of the property.

Returns

mi::nservices::NRS_ERROR_NONE : success. mi::nservices::NRS_ERROR_INVALID_PARAMETERS : Invalid key or value. mi::nservices::NRS_ERROR_NEURAY : internal error.