26 const char *derived_name;
44 fprintf(stderr,
"Unable to derive %s -> %s: %d.\n",
45 src_name, derived_name, err);
50 if (derived_dev->
type != derived_type) {
51 fprintf(stderr,
"Device derived as type %d has type %d.\n",
52 derived_type, derived_dev->
type);
56 if (derived_type == src_dev->
type) {
57 if (derived_dev != src_dev) {
58 fprintf(stderr,
"Derivation of %s from itself succeeded "
59 "but did not return the same device.\n", src_name);
69 fprintf(stderr,
"Derivation %s to %s succeeded, but derivation "
70 "back again failed: %d.\n",
71 src_name, derived_name, err);
75 if (back_ref->data != src_ref->
data) {
76 fprintf(stderr,
"Derivation %s to %s succeeded, but derivation "
77 "back again did not return the original device.\n",
78 src_name, derived_name);
82 fprintf(stderr,
"Successfully tested derivation %s -> %s.\n",
83 src_name, derived_name);
106 fprintf(stderr,
"Failed to create %s device: %d.\n", name, err);
112 fprintf(stderr,
"Device created as type %d has type %d.\n",
118 fprintf(stderr,
"Device type %s successfully created.\n", name);
127 static const struct {
134 {
"/dev/dri/card0",
"/dev/dri/card1",
135 "/dev/dri/renderD128",
"/dev/dri/renderD129" } },
141 {
"0.0",
"0.1",
"1.0",
"1.1" } },
143 {
"/dev/dri/renderD128",
"/dev/dri/renderD129",
":0" } },
150 int i, j, found, err;
154 fprintf(stderr,
"No name available for device type %d.\n", type);
160 fprintf(stderr,
"Type %d maps to name %s maps to type %d.\n",
169 fprintf(stderr,
"Test failed for %s with default options.\n", name);
173 fprintf(stderr,
"Test passed for %s with default options.\n", name);
186 fprintf(stderr,
"Test failed for %s with device %s.\n",
191 fprintf(stderr,
"Test passed for %s with device %s.\n",
206 pass = fail = skip = 0;
221 fprintf(stderr,
"Attempted to test %d device types: "
222 "%d passed, %d failed, %d skipped.\n",
223 pass + fail + skip, pass, fail, skip);
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name)
Look up an AVHWDeviceType by name.
int av_hwdevice_ctx_create(AVBufferRef **pdevice_ref, enum AVHWDeviceType type, const char *device, AVDictionary *opts, int flags)
Open a device of the specified type and create an AVHWDeviceContext for it.
static const struct @297 test_devices[]
enum AVHWDeviceType type
This field identifies the underlying API used for hardware access.
static int test_derivation(AVBufferRef *src_ref, const char *src_name)
const char * possible_devices[5]
static int test_device_type(enum AVHWDeviceType type)
int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ref_ptr, enum AVHWDeviceType type, AVBufferRef *src_ref, int flags)
Create a new device of the specified type from an existing device.
#define FF_ARRAY_ELEMS(a)
uint8_t * data
The data buffer.
const char * av_hwdevice_get_type_name(enum AVHWDeviceType type)
Get the string name of an AVHWDeviceType.
#define flags(name, subs,...)
A reference to a data buffer.
static int ref[MAX_W *MAX_W]
enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev)
Iterate over supported device types.
static int test_device(enum AVHWDeviceType type, const char *name, const char *device, AVDictionary *opts, int flags)
#define check(x, y, S, v)