class dlstreamer::FFmpegContext#

Overview#

#include <context.h>

class FFmpegContext: public dlstreamer::BaseContext {
public:
    // structs

    struct key;

    // construction

    FFmpegContext(
        AVHWDeviceType hw_device_type = AV_HWDEVICE_TYPE_VAAPI,
        const char* device = nullptr
    );

    FFmpegContext(AVBufferRef* hw_device_ctx, bool take_ownerwhip = true);

    FFmpegContext(
        std::string_view accel_type = std::string_view(),
        std::string_view device = std::string_view()
    );

    // methods

    AVBufferRef* hw_device_context_ref() const;
    AVHWDeviceContext* hw_device_context() const;
    AVHWDeviceType hw_device_type() const;
    virtual std::vector<std::string> keys() const;
    virtual void* handle(std::string_view key) const;

    virtual MemoryMapperPtr get_mapper(
        const ContextPtr& input_context,
        const ContextPtr& output_context
    );
};

Inherited Members#

public:
    // typedefs

    typedef void* handle_t;

    // structs

    struct key;

    // methods

    virtual MemoryType memory_type() const = 0;
    virtual handle_t handle(std::string_view key = {}) const = 0;

    virtual MemoryMapperPtr get_mapper(
        const ContextPtr& input_context,
        const ContextPtr& output_context
    ) = 0;

    virtual ContextPtr derive_context(MemoryType memory_type) = 0;
    virtual ContextPtr parent() = 0;
    virtual MemoryType memory_type() const;
    virtual handle_t handle(std::string_view key) const;
    virtual std::vector<std::string> keys() const;

    virtual MemoryMapperPtr get_mapper(
        const ContextPtr& input_context,
        const ContextPtr& output_context
    );

    virtual ContextPtr derive_context(MemoryType memory_type);
    virtual ContextPtr parent();
    void set_parent(ContextPtr parent);
    void set_memory_type(MemoryType memory_type);
    void attach_mapper(MemoryMapperPtr mapper);
    void remove_mapper(MemoryMapperPtr mapper);

Detailed Documentation#

Methods#

virtual void* handle(std::string_view key) const

Returns a handle by key. If empty key, returns default handle. If no handle with the specified key, returns 0.

Parameters:

key

the key of the handle to find

virtual MemoryMapperPtr get_mapper(
    const ContextPtr& input_context,
    const ContextPtr& output_context
)

Returns an object for memory mapping between two contexts. Function typically expects one of contexts to be this context. If one of contexts has memory type CPU or context reference is nullptr, function returns object for mapping to or from system memory. If creating memory mapping object failed, exception is thrown.

Parameters:

input_context

Context of input memory

output_context

Context of output memory