DiCE API nvidia_logo_transpbg.gif Up
mi::bridge::IServer_video_context Class Referenceabstract

Server-side video context that generates and encodes video frames for the corresponding client-side video context. More...

#include <ibridge_video_server.h>

Inheritance diagram for mi::bridge::IServer_video_context:

Public Member Functions

virtual void frame_ready ()=0
 Notifies the Bridge that the application produced the next video frame. More...
 
virtual void set_video_source (IVideo_source *video_source)=0
 Sets the video source that will produce video frames generated by the server. More...
 
virtual IVideo_sourceget_video_source () const =0
 Returns the currently set video source, or NULL if none is set. More...
 
virtual Sint32 set_video_format (const char *format)=0
 Sets the video format for encoding. More...
 
virtual const IStringget_video_format () const =0
 Returns the current video format for encoding. More...
 
virtual Sint32 set_max_frame_rate (Uint32 frame_rate)=0
 Sets the maximum frame rate. More...
 
virtual Uint32 get_max_frame_rate () const =0
 Returns the maximum frame rate. More...
 
virtual Sint32 set_render_frame_rate (Float64 frame_rate)=0
 Sets the current frame rate. More...
 
virtual Sint32 set_bit_rate (Uint32 bit_rate)=0
 Sets the bit rate. More...
 
virtual Sint32 set_max_bitrate (Uint32 bit_rate)=0
 Sets the maximum bitrate used by the video stream. More...
 
virtual Uint32 get_max_bitrate () const =0
 Returns the currently set maximum bitrate. More...
 
virtual Sint32 set_min_bitrate (Uint32 bit_rate)=0
 Sets the minimum bitrate used by the video stream. More...
 
virtual Uint32 get_min_bitrate () const =0
 Returns the currently set minimum bitrate. More...
 
virtual Uint32 get_bit_rate () const =0
 Returns the currently used bit rate. More...
 
virtual void report_progress (Float64 value, const char *area, const char *message)=0
 Communicates a progress message to the client side. More...
 
virtual void report_error (Sint32 error_code, const char *error_message)=0
 Communicates an error message to the client side. More...
 
virtual void reset ()=0
 Resets the video stream and any stateful video encoders like h264. More...
 
virtual void close ()=0
 Closes the video stream associated with this context and frees all resources. More...
 
virtual Uint32 get_id () const =0
 Returns the ID of the video context. More...
 
- Public Member Functions inherited from mi::base::IInterface
virtual Uint32 retain () const =0
 Increments the reference count. More...
 
virtual Uint32 release () const =0
 Decrements the reference count. More...
 
virtual const IInterfaceget_interface (const Uuid &interface_id) const =0
 Acquires a const interface from another. More...
 
template<class T>
const T * get_interface () const
 Acquires a const interface from another. More...
 
virtual IInterfaceget_interface (const Uuid &interface_id)=0
 Acquires a mutable interface from another. More...
 
template<class T>
T * get_interface ()
 Acquires a mutable interface from another. More...
 
virtual Uuid get_iid () const =0
 Returns the interface ID of the most derived interface. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x9f1c260c, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::IInterface
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x9f1c260c, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::IInterface
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface. More...
 

Detailed Description

Server-side video context that generates and encodes video frames for the corresponding client-side video context.

An application using the video transmission facilities of the Bridge API must implement the abstract interface mi::bridge::IVideo_source and set it by calling set_video_source() to generate video frames.

Note that even though the focus is on video, it is equally valid to transmit any kind of data suitable for streaming, and the application can deliver pure data buffers in addition to, or instead of, video frames.

See also
mi::bridge::IServer_session::get_video_context(), mi::bridge::IClient_video_context

Member Function Documentation

 close()

virtual void mi::bridge::IServer_video_context::close ( )
pure virtual

Closes the video stream associated with this context and frees all resources.

This will also close the associated video context on the client.

set_video_source(), mi::bridge::IClient_video_context

 frame_ready()

virtual void mi::bridge::IServer_video_context::frame_ready ( )
pure virtual

Notifies the Bridge that the application produced the next video frame.

When the process is ready to process the next frame it calls as response the callback mi::bridge::IVideo_source::video_get_next_frame() of the video source associated with this video context (see also set_video_source()).

This method can be called any number of times between callbacks, but multiple calls after the last video_get_next_frame() callback will only result in a single callback of video_get_next_frame().

 get_bit_rate()

virtual Uint32 mi::bridge::IServer_video_context::get_bit_rate ( ) const
pure virtual

Returns the currently used bit rate.

See also
set_bit_rate()

 get_id()

virtual Uint32 mi::bridge::IServer_video_context::get_id ( ) const
pure virtual

Returns the ID of the video context.

 get_max_bitrate()

virtual Uint32 mi::bridge::IServer_video_context::get_max_bitrate ( ) const
pure virtual

Returns the currently set maximum bitrate.

See also
set_max_bitrate()

 get_max_frame_rate()

virtual Uint32 mi::bridge::IServer_video_context::get_max_frame_rate ( ) const
pure virtual

Returns the maximum frame rate.

See also
set_max_frame_rate()

 get_min_bitrate()

virtual Uint32 mi::bridge::IServer_video_context::get_min_bitrate ( ) const
pure virtual

Returns the currently set minimum bitrate.

See also
set_min_bitrate()

 get_video_format()

virtual const IString * mi::bridge::IServer_video_context::get_video_format ( ) const
pure virtual

Returns the current video format for encoding.

See also
set_video_format()

 get_video_source()

virtual IVideo_source * mi::bridge::IServer_video_context::get_video_source ( ) const
pure virtual

Returns the currently set video source, or NULL if none is set.

 report_error()

virtual void mi::bridge::IServer_video_context::report_error ( Sint32  error_code,
const char *  error_message 
)
pure virtual

Communicates an error message to the client side.

The Bridge video protocol invokes IVideo_sink::video_error() on the video sink associated with the corresponding video context on the client side and passes the arguments provided here.

Parameters
error_codeError code specified by the application.
error_messageA short description of the error.

 report_progress()

virtual void mi::bridge::IServer_video_context::report_progress ( Float64  value,
const char *  area,
const char *  message 
)
pure virtual

Communicates a progress message to the client side.

The Bridge video protocol invokes IVideo_sink::video_progress() on the video sink associated with the corresponding video context on the client side and passes the arguments provided here.

Parameters
valueThe progress value.
areaThe progress area.
messageThe progress message.

 reset()

virtual void mi::bridge::IServer_video_context::reset ( )
pure virtual

Resets the video stream and any stateful video encoders like h264.

 set_bit_rate()

virtual Sint32 mi::bridge::IServer_video_context::set_bit_rate ( Uint32  bit_rate)
pure virtual

Sets the bit rate.

This method is deprecated and is equivalent to calling set_max_bitrate() and set_min_bitrate() with the same value.

The "h264" format will use the frame rate and the current bit rate when calculating the budget for each frame. The quality of the "lossless" format and image formats is not affected by this setting.

Note
It is recommended to change settings like video format, frame rate, and bit rate only from the mi::bridge::IVideo_source::video_get_next_frame() callback (or before the first call to frame_ready()). Otherwise, it is not guaranteed that multiple changes will be applied atomically to the next frame (because encoding of the next frame might start at any time).
See also
get_bit_rate(), set_video_format(), set_max_frame_rate()
Parameters
bit_rateThe bit rate to use
Returns
0 in case of success, < 0 in case of failure.

 set_max_bitrate()

virtual Sint32 mi::bridge::IServer_video_context::set_max_bitrate ( Uint32  bit_rate)
pure virtual

Sets the maximum bitrate used by the video stream.

To adapt to the available bandwidth, the bridge video will automatically adjust the bitrate. However, the bitrate will not be set below the minimum bitrate. If the available bandwidth is smaller then frame rate will go down to compensate. Likewise, the bitrate won't go above the set maximum bitrate. Set min and max bitrate to the same value to override the automatic adjustment. The max bitrate setting takes precedence if max bitrate is set lower than min bitrate.

The "h264" format will use the frame rate and the current bit rate when calculating the budget for each frame. The quality of the "lossless" format and image formats is not affected by this setting.

Note
It is recommended to change settings like video format, frame rate, and bit rate only from the mi::bridge::IVideo_source::video_get_next_frame() callback (or before the first call to frame_ready()). Otherwise, it is not guaranteed that multiple changes will be applied atomically to the next frame (because encoding of the next frame might start at any time).
See also
get_max_bitrate(), set_min_bitrate(), get_bit_rate(), set_video_format(), set_max_frame_rate()
Parameters
bit_rateThe bit rate to use
Returns
0 in case of success, < 0 in case of failure.

 set_max_frame_rate()

virtual Sint32 mi::bridge::IServer_video_context::set_max_frame_rate ( Uint32  frame_rate)
pure virtual

Sets the maximum frame rate.

This setting limits the rate at with which frames are sent from the server to this rate, but the frame rate is allowed to drop below this if frames are not produced or encoded quickly enough.

The "h264" format will use the frame rate and the current bit rate when calculating the budget for each frame. The quality of the "lossless" format and image formats is not affected by this setting.

Note
It is recommended to change settings like video format, frame rate, and bit rate only from the mi::bridge::IVideo_source::video_get_next_frame() callback (or before the first call to frame_ready()). Otherwise, it is not guaranteed that multiple changes will be applied atomically to the next frame (because encoding of the next frame might start at any time).
See also
get_max_frame_rate(), set_video_format(), set_bit_rate()
Parameters
frame_rateThe maximum frame rate to use.
Returns
0 in case of success, < 0 in case of failure.

 set_min_bitrate()

virtual Sint32 mi::bridge::IServer_video_context::set_min_bitrate ( Uint32  bit_rate)
pure virtual

Sets the minimum bitrate used by the video stream.

To adapt to the available bandwidth, the bridge video will automatically adjust the bitrate. is smaller then frame rate will go down to compensate. Likewise, the bitrate won't go above the set maximum bitrate. Set min and max bitrate to the same value to override the automatic adjustment. The max bitrate setting takes precedence if max bitrate is set lower than min bitrate.

The "h264" format will use the frame rate and the current bit rate when calculating the budget for each frame. The quality of the "lossless" format and image formats is not affected by this setting.

Note
It is recommended to change settings like video format, frame rate, and bit rate only from the mi::bridge::IVideo_source::video_get_next_frame() callback (or before the first call to frame_ready()). Otherwise, it is not guaranteed that multiple changes will be applied atomically to the next frame (because encoding of the next frame might start at any time).
See also
get_max_bitrate(), set_min_bitrate(), get_bit_rate(), set_video_format(), set_max_frame_rate()
Parameters
bit_rateThe bit rate to use
Returns
0 in case of success, < 0 in case of failure.

 set_render_frame_rate()

virtual Sint32 mi::bridge::IServer_video_context::set_render_frame_rate ( Float64  frame_rate)
pure virtual

Sets the current frame rate.

This is an optional hint that can be set to inform the video context about the actual current frame rate. It is recommended to call this every time the actual frame rate changes substantially, or simply call in each mi::bridge::IVideo_source::video_get_next_frame() callback with the current value.

Note
It is recommended to change settings like video format, frame rate, and bit rate only from the mi::bridge::IVideo_source::video_get_next_frame() callback (or before the first call to frame_ready()). Otherwise, it is not guaranteed that multiple changes will be applied atomically to the next frame (because encoding of the next frame might start at any time).
See also
get_max_frame_rate(), set_video_format(), set_bit_rate()
Parameters
frame_rateThe maximum frame rate to use.
Returns
0 in case of success, < 0 in case of failure.

 set_video_format()

virtual Sint32 mi::bridge::IServer_video_context::set_video_format ( const char *  format)
pure virtual

Sets the video format for encoding.

Note
It is recommended to change settings like video format, frame rate, and bit rate only from the mi::bridge::IVideo_source::video_get_next_frame() callback (or before the first call to frame_ready()). Otherwise, it is not guaranteed that multiple changes will be applied atomically to the next frame (because encoding of the next frame might start at any time).
See also
get_video_format(), set_max_frame_rate(), set_bit_rate()
Parameters
formatThe video format to use when encoding canvases. Supported formats:
  • "h264": h264 encoding, requires an h264 encoder plugin.
  • "lossless": lossless encoding, supports all pixel formats, built-in.
  • any valid image format: any supported image format, requires the corresponding image plugin.
Returns
  • 0: Success.
  • -1: Unsupported format.
  • <= -2: Unspecified error.

 set_video_source()

virtual void mi::bridge::IServer_video_context::set_video_source ( IVideo_source video_source)
pure virtual

Sets the video source that will produce video frames generated by the server.

Parameters
video_sourceThe video source to set. Replaces any previously set video source (if any). Pass NULL to disconnect the currently set video source.