DiCE API nvidia_logo_transpbg.gif Up
mi::neuraylib::IVideo_encoder Class Referenceabstract

Abstract interface for video encoders. More...

#include <ivideo_plugin.h>

Inheritance diagram for mi::neuraylib::IVideo_encoder:

Public Member Functions

virtual Sint32 init (Uint32 resolution_x, Uint32 resolution_y, IVideo_data **out)=0
 Initializes the video stream. More...
 
virtual bool set_parameter (const char *name, const char *value)=0
 Sets a parameter for the video stream. More...
 
virtual const char * get_parameter (const char *name)=0
 Returns the value of a parameter for the video stream. More...
 
virtual const char * get_supported_type (Uint32 index) const =0
 Returns the index -th supported pixel type. More...
 
virtual Sint32 encode_canvas (const ICanvas *canvas, IVideo_data **out)=0
 Encodes the pixel data contained in a canvas. More...
 
virtual Sint32 encode_canvas (const ICanvas_cuda *canvas, IVideo_data **out)=0
 Encodes the pixel data contained in a cuda canvas. More...
 
virtual Sint32 close (IVideo_data **out)=0
 Closes the video stream. More...
 
virtual const char * get_identifier () const =0
 Returns a concise single-line unique identifier. 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< 0x572ef6ad, ... >
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< 0x572ef6ad, ... >
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

Abstract interface for video encoders.

Note that the video encoder has an internal state. Hence, a separate encoder is needed for each stream. It is not possible to use one encoder for different streams, even if all parameters are identical. Therefore, the terms "encoder" and "stream" are used synonymously below.

Member Function Documentation

 close()

virtual Sint32 mi::neuraylib::IVideo_encoder::close ( IVideo_data **  out)
pure virtual

Closes the video stream.

Parameters
[out]outReturns any remaining encoded data here. The ownership of *out is passed to the caller as for a return value. In particular, the caller must call release() when *out is no longer needed.
Returns
  • 0: Successfully closed.
  • -1: Not initialized or already closed.
  • -2: Failed to perform cleanup.
  • <-2: Unspecified error.

 encode_canvas() [1/2]

virtual Sint32 mi::neuraylib::IVideo_encoder::encode_canvas ( const ICanvas canvas,
IVideo_data **  out 
)
pure virtual

Encodes the pixel data contained in a canvas.

Parameters
canvasEncode this canvas.
[out]outThe encoded data. The ownership of *out is passed to the caller as for a return value. In particular, the caller must call release() when *out is no longer needed.
Returns
  • 0: Canvas successfully encoded.
  • -1: Invalid parameters.
  • -2: Not initialized or closed.
  • -3: Memory/buffer allocation problem.
  • -4: Failed to encode frame.
  • <-4: For unspecified error.

 encode_canvas() [2/2]

virtual Sint32 mi::neuraylib::IVideo_encoder::encode_canvas ( const ICanvas_cuda canvas,
IVideo_data **  out 
)
pure virtual

Encodes the pixel data contained in a cuda canvas.

Parameters
canvasEncode this cuda canvas.
[out]outThe encoded data. The ownership of *out is passed to the caller as for a return value. In particular, the caller must call release() when *out is no longer needed.
Returns
  • 0: Canvas successfully encoded.
  • -1: Invalid parameters.
  • -2: Not initialized or closed.
  • -3: Memory/buffer allocation problem.
  • -4: Failed to encode frame.
  • -5: unsupported canvas type
  • <-5: For unspecified error.

 get_identifier()

virtual const char * mi::neuraylib::IVideo_encoder::get_identifier ( ) const
pure virtual

Returns a concise single-line unique identifier.

 get_parameter()

virtual const char * mi::neuraylib::IVideo_encoder::get_parameter ( const char *  name)
pure virtual

Returns the value of a parameter for the video stream.

Parameters
nameThe name of the parameter to query.
Returns
The value of the parameter, or NULL if it doesn't exist.

 get_supported_type()

virtual const char * mi::neuraylib::IVideo_encoder::get_supported_type ( Uint32  index) const
pure virtual

Returns the index -th supported pixel type.

The canvas passed to encode_canvas() must use one of the supported types.

The pixel types should be ordered, from index 0 for the most preferred to the least preferred type. See Types for a list of supported pixel types.

Parameters
indexThe index of the pixel type to be returned.
Returns
The index -th supported pixel type, NULL if index is out of bounds.

 init()

virtual Sint32 mi::neuraylib::IVideo_encoder::init ( Uint32  resolution_x,
Uint32  resolution_y,
IVideo_data **  out 
)
pure virtual

Initializes the video stream.

Parameters
resolution_xThe width of the video stream.
resolution_yThe height of the video stream.
[out]outOptionally, the method may return data. The ownership of *out is passed to the caller as for a return value. In particular, the caller must call release() when *out is no longer needed.
Returns
  • 0: If the encoder was successfully initialized.
  • -1: Invalid parameters.
  • -2: If the specified resolution is not supported.
  • -3: Already initialized or closed.
  • -4: No suitable device (hardware encoders only)
  • -5: Failed to initialize encoder or other needed libraries.
  • <-5: For unspecified error.

 set_parameter()

virtual bool mi::neuraylib::IVideo_encoder::set_parameter ( const char *  name,
const char *  value 
)
pure virtual

Sets a parameter for the video stream.

Parameters
nameThe name of the parameter to be changed.
valueThe new value to be set for the parameter.
Returns
true, if the parameter could be successfully set, false otherwise.