neuray API Programmer's Manual

mi::neuraylib::IVideo_encoder Class Reference

[Extensions and Plugins]

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.

Public Member Functions

virtual Sint32 close( IVideo_data** out) =0
Closes the video stream. 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 const char* get_identifier() const =0
Returns a concise single-line unique identifier.
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 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...

Member Functions

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

Closes the video stream.

Parameters

out
Returns 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.

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

canvas
Encode this canvas.
out
The 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.

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

canvas
Encode this cuda canvas.
out
The 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.

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

Returns a concise single-line unique identifier.

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

name
The name of the parameter to query.

Returns

The value of the parameter, or NULL if it doesn't exist.

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

index
The index of the pixel type to be returned.

Returns

The index -th supported pixel type, NULL if index is out of bounds.

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

Initializes the video stream.

Parameters

resolution_x
The width of the video stream.
resolution_y
The height of the video stream.
out
Optionally, 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.

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

Sets a parameter for the video stream.

Parameters

name
The name of the parameter to be changed.
value
The new value to be set for the parameter.

Returns

true , if the parameter could be successfully set, false otherwise.