nx_server_plugin_sdk 1.0 Server Plugin SDK

Public Member Functions | Static Public Member Functions | List of all members
nx::sdk::cloud_storage::IStreamWriter Class Referenceabstract

`#include <i_stream_writer.h>`

Inheritance diagram for nx::sdk::cloud_storage::IStreamWriter:

## Public Member Functions
virtual ErrorCode | putData (const IMediaDataPacket *packet)=0
virtual ErrorCode | close (int64_t durationMs)=0
virtual int | size () const =0
virtual const char * | locationUrl () const =0
Public Member Functions inherited from nx::sdk::Interface< IStreamWriter >
virtual IRefCountable * | queryInterface (const InterfaceId *id)
Ptr< Interface > | queryInterface ()
Ptr< const Interface > | queryInterface () const
Public Member Functions inherited from nx::sdk::IRefCountable
virtual | ~IRefCountable ()=default
template<class Interface >
Ptr< Interface > | queryInterface ()
template<class Interface >
Ptr< const Interface > | queryInterface () const
virtual int | addRef () const =0
virtual int | releaseRef () const =0
int | refCountThreadUnsafe () const

## Static Public Member Functions
static auto | interfaceId ()
Static Public Member Functions inherited from nx::sdk::IRefCountable
static auto | interfaceId ()

## Additional Inherited Members
Protected Member Functions inherited from nx::sdk::Interface< IStreamWriter >
virtual IRefCountable * | queryInterface (const IRefCountable::InterfaceId *id) override
IRefCountable * | queryInterfaceSupportingDeprecatedId (const IRefCountable::InterfaceId *id, const Uuid &deprecatedInterfaceId)
Static Protected Member Functions inherited from nx::sdk::IRefCountable
template<int len>
static const InterfaceId * | makeId (const char(&charArray)[len])
template<int len, int alternativeLen>
static std::vector< const InterfaceId * > | makeIdWithAlternative (const char(&charArray)[len], const char(&alternativeCharArray)[alternativeLen])
template<class TemplateInstance , class TemplateArg , int len>
static const InterfaceId * | makeIdForTemplate (const char(&baseIdCharArray)[len])
static std::vector< const InterfaceId * > | alternativeInterfaceIds (const InterfaceId *id)
static std::vector< const InterfaceId * > | alternativeInterfaceIds (std::vector< const InterfaceId *> ids)

## Detailed Description

Stream writer abstraction. Stream is a sequence of media data packets, which more or less represent continuous chunk of media and metadata for the given period of time. When Mediaserver is finished with the current stream ~IStreamWriter() will be called. Implementation might do some finalization at this point. Server will create a StreamWriter object for each chunk of media data. So the media stream, being continuous is still cut on the small chunks of data each of which has its timestamp and duration. Each of those chunks are recorded using Stream Writer and subsequently requested back using a corresponding StreamReader object.

## Member Function Documentation

## ◆ close()

virtual ErrorCode nx::sdk::cloud_storage::IStreamWriter::close | ( | int64_t | durationMs | ) |
| pure virtual

This function will be called just before destruction of the StreamWriter object and no other calls (except destructor) will follow.

Implemented in nx::vms_server_plugins::cloud_storage::stub::StreamWriter, and nx::vms_server_plugins::cloud_storage::sample::StreamWriter.

## ◆ locationUrl()

virtual const char* nx::sdk::cloud_storage::IStreamWriter::locationUrl | ( |  | ) | const
| pure virtual

Returns last location of where data has been written. It's not location of an individual media chunk, but general physical storage location. This url should be passed later to the DeviceAgent::createStreamReader when requesting this media chunk for reading later.

Implemented in nx::vms_server_plugins::cloud_storage::stub::StreamWriter, and nx::vms_server_plugins::cloud_storage::sample::StreamWriter.

## ◆ putData()

virtual ErrorCode nx::sdk::cloud_storage::IStreamWriter::putData | ( | const IMediaDataPacket * | packet | ) |
| pure virtual

Write a data packet. Implementation is discouraged to buffer packets. Instead, it should block until the data is completely processed.

packet->channelNumber() corresponds to ICodecInfo::channelNumber() i.e. if packet->type() == dptVideo && packet->channelNumber() == 1, then CodecInfo with mediaType == AVMEDIA_TYPE_VIDEO && channelNumber == 1 can be used to process this packet.

If packet->type() == dptAudio && packet->channelNumber() == 0, then CodecInfo with mediaType == AVMEDIA_TYPE_AUDIO && channelNumber == 0 can be used to process this packet.

If packet->type() == dptData && packet->channelNumber() == 0, then CodecInfo with mediaType == AVMEDIA_TYPE_DATA && channelNumber == 0 can be used to process this packet.

Implemented in nx::vms_server_plugins::cloud_storage::stub::StreamWriter, and nx::vms_server_plugins::cloud_storage::sample::StreamWriter.

## ◆ size()

virtual int nx::sdk::cloud_storage::IStreamWriter::size | ( |  | ) | const
| pure virtual

Total size of written data so far.

Implemented in nx::vms_server_plugins::cloud_storage::stub::StreamWriter, and nx::vms_server_plugins::cloud_storage::sample::StreamWriter.

The documentation for this class was generated from the following file:

- src/nx/sdk/cloud_storage/i_stream_writer.h