neuray API Programmer's Manual

mi::neuraylib::IVideo_decoder Class Reference

[Extensions and Plugins]

Description

Abstract interface for video decoders. Note that the video decoder has an internal state. Hence, a separate decoder is needed for each stream. It is not possible to use one decoder for different streams, even if all parameters are identical.

Public Member Functions

virtual Sint32 close() =0
Closes the video stream. More...
virtual Sint32 decode_canvas( neuraylib::​ICanvas* canvas, IBuffer* data) =0
Decodes video stream data to a canvas. More...
virtual Uint32 get_encoded_height() =0
Returns the encoded height of the video stream. More...
virtual Uint32 get_encoded_width() =0
Returns the encoded width of the video stream. More...
virtual const char* get_format_parameter( const char* parameter) =0
Returns a video stream format parameter. Only available after initialization is completed.
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 of the decoder. More...
virtual const char* get_supported_type( Uint32 index) const =0
Returns the index -th supported pixel type. More...
virtual Sint32 init( IBuffer* data) =0
Initializes the video decoder. More...
virtual bool  set_parameter( const char* name, const char* value) =0
Sets a parameter of the decoder. More...

Member Functions

virtual Sint32 mi::​neuraylib::​IVideo_decoder::close() [pure virtual]

Closes the video stream.

Returns

  • 0: Decoder successfully closed.
  • <0: Unspecified error.

virtual Sint32 mi::​neuraylib::​IVideo_decoder::decode_canvas( neuraylib::​ICanvas* canvas, IBuffer* data) [pure virtual]

Decodes video stream data to a canvas. Note that the provided data might contain enough information for several frames in which case 1 is returned. Call multiple times with NULL for data until 0 (or 2) is returned. If the data is not enough for a complete frame then 2 is returned in which case decode_canvas() must be called with more data before the frame can be decoded.

Parameters

canvas
The target canvas.
data
The data to decode.

Returns

  • 0: Frame successfully decoded.
  • 1: Successfully decoded frame, more frames are buffered.
  • 2: Insufficient data, call again with more data.
  • -1: Invalid parameters.
  • -2: Not initialized or closed.
  • -3: Parse error.
  • <-3: Unspecified error.

virtual Uint32 mi::​neuraylib::​IVideo_decoder::get_encoded_height() [pure virtual]

Returns the encoded height of the video stream. Only available after a completed initialization.

virtual Uint32 mi::​neuraylib::​IVideo_decoder::get_encoded_width() [pure virtual]

Returns the encoded width of the video stream. Only available after a completed initialization.

virtual const char* mi::​neuraylib::​IVideo_decoder::get_format_parameter( const char* parameter) [pure virtual]

Returns a video stream format parameter. Only available after initialization is completed.

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

Returns a concise single-line unique identifier.

virtual const char* mi::​neuraylib::​IVideo_decoder::get_parameter( const char* name) [pure virtual]

Returns the value of a parameter of the decoder.

Parameters

name
The name of the parameter to query.

Returns

The value of the parameter.

virtual const char* mi::​neuraylib::​IVideo_decoder::get_supported_type( Uint32 index) const [pure virtual]

Returns the index -th supported pixel type. The canvas passed to decode_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_decoder::init( IBuffer* data) [pure virtual]

Initializes the video decoder. If not enough data is provided then 1 is returned and this method must be called again with more data. If enough data was present to decode one or more frames, then those frames will be decoded as part of this call. After the call to init(), call decode_canvas() with data set to NULL to get any buffered frames.

Parameters

data
Video stream data to be decoded.

Returns

  • 0: If the decoder was successfully initialized.
  • 1: Need more data.
  • -1: Invalid parameters.
  • -2: Already initialized or closed.
  • -3: No suitable device found (hardware decoders only).
  • -4: Failed to initialize encoder or other needed libraries.
  • -5: Error parsing data.
  • <-5: Unspecified error.

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

Sets a parameter of the decoder.

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.