NVIDIA Iray API Home  Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
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...

Inheritance diagram for mi::bridge::IServer_video_context:
Inheritance graph
[legend]

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_source get_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 IString get_video_format () const =0
  Returns the current video format for encoding. More...
 
virtual Sint32  set_frame_rate (Uint32 frame_rate)=0
  Sets the maximum frame rate. More...
 
virtual Uint32  get_frame_rate () const =0
  Returns the maximum frame rate. More...
 
virtual Sint32  set_bit_rate (Uint32 bit_rate)=0
  Sets the bit rate. More...
 
virtual Uint32  get_bit_rate () const =0
  Returns the bit rate. More...
 
virtual Sint32  set_max_pending_frames (Uint32 count)=0
  Sets the maximum number of pending frames that the Bridge video protocol will allow. More...
 
virtual Uint32  get_max_pending_frames () const =0
  Returns the maximum number of pending frames. 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...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0x9f1c260c, 0x43a7, 0x439e, 0x9a, 0x9f, 0xb0, 0xc0, 0x24, 0xc4, 0xdc, 0xbe >
typedef Interface_declare< id1,
id2, id3, id4, id5, id6, id7,
id8, id9, id10, id11,
IInterface
Self
  Own type. More...
 
typedef Uuid_t< id1, id2, id3,
id4, id5, id6, id7, id8, id9,
id10, id11 > 
IID
  Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0x9f1c260c, 0x43a7, 0x439e, 0x9a, 0x9f, 0xb0, 0xc0, 0x24, 0xc4, 0xdc, 0xbe >
static bool  compare_iid (const Uuid &iid)
  Compares the interface ID iid against the interface ID of this interface and of its ancestors. 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

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

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().

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

Returns the bit rate.

See Also
set_bit_rate()
virtual Uint32 mi::bridge::IServer_video_context::get_frame_rate ( ) const
pure virtual

Returns the maximum frame rate.

See Also
set_frame_rate()
virtual Uint32 mi::bridge::IServer_video_context::get_id ( ) const
pure virtual

Returns the ID of the video context.

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

Returns the maximum number of pending frames.

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()
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.

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_code Error code specified by the application.
error_message A short description of the error.
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
value The progress value.
area The progress area.
message The progress message.
virtual void mi::bridge::IServer_video_context::reset ( )
pure virtual

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

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

Sets the bit rate.

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_frame_rate()
Parameters
bit_rate The bit rate to use
Returns
0 in case of success, < 0 in case of failure.
virtual Sint32 mi::bridge::IServer_video_context::set_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_frame_rate(), set_video_format(), set_bit_rate()
Parameters
frame_rate The maximum frame rate to use.
Returns
0 in case of success, < 0 in case of failure.
virtual Sint32 mi::bridge::IServer_video_context::set_max_pending_frames ( Uint32  count)
pure virtual

Sets the maximum number of pending frames that the Bridge video protocol will allow.

This prevents the server from sending more frames than the network or the client can handle to avoid frames from being queued up which could potentially cause a huge lag on the client. Setting this to a low value makes sure that the lag on the client is at a minimum even if the network can not always cope with the load, but at the expense of frame rate since the server might need to pause more often. The default of 3 frames at 15 fps is a reasonable compromise for most conditions. If ping time to the server is very high or if frame rate is set to a higher value this might have to be increased to maintain a good frame rate.

Parameters
count The maximum number of pending frames
Returns
0 in case of success, < 0 in case of failures.
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_frame_rate(), set_bit_rate()
Parameters
format The 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.
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_source The video source to set. Replaces any previously set video source (if any). Pass NULL to disconnect the currently set video source.