hwcontext: Add device derivation

Creates a new device context from another of a different type which
refers to the same underlying hardware.

(cherry picked from commit b266ad56fe)
This commit is contained in:
Mark Thompson
2017-03-04 23:57:28 +00:00
parent 92bd089745
commit b22172f6f3
5 changed files with 103 additions and 1 deletions

View File

@ -66,6 +66,8 @@ typedef struct HWContextType {
int (*device_create)(AVHWDeviceContext *ctx, const char *device,
AVDictionary *opts, int flags);
int (*device_derive)(AVHWDeviceContext *dst_ctx,
AVHWDeviceContext *src_ctx, int flags);
int (*device_init)(AVHWDeviceContext *ctx);
void (*device_uninit)(AVHWDeviceContext *ctx);
@ -95,6 +97,12 @@ typedef struct HWContextType {
struct AVHWDeviceInternal {
const HWContextType *hw_type;
void *priv;
/**
* For a derived device, a reference to the original device
* context it was derived from.
*/
AVBufferRef *source_device;
};
struct AVHWFramesInternal {