Device

Device — Hardware device management interface

Functions

Types and Values

Description

These devices can be enumerated and passed to flu_player_device_open(), instead of flu_player_uri_open(), which requires a URI. Devices allow the application to access cameras, microphones, screen/application capture or DVD drives, which do not map nicely to URIs in most cases.

Functions

flu_device_list_get ()

GList *
flu_device_list_get ();

Retrieves the list of currently available hardware devices as a GList of FluDevice.

Free the whole list afterwards with flu_device_list_free(), or keep extra references with flu_device_ref() and flu_device_unref()

Returns

The GList of hardware devices.

[element-type FluDevice][transfer full]


flu_device_ref ()

FluDevice *
flu_device_ref (FluDevice *device);

Add a reference to an FluDevice

Parameters

device

The device to be referenced

 

Returns

The same object, for programming convenience.

[transfer full]


flu_device_unref ()

void
flu_device_unref (FluDevice *device);

Remove a reference from an FluDevice

Parameters

device

The device to be unreferenced

 

flu_device_list_free ()

void
flu_device_list_free (GList *devices_list);

Frees a device list returned by flu_device_list_get().

This is a convenience wrapper around g_list_free_full() calling flu_device_unref() for each entry in the list.

Parameters

devices_list

The list to free.

[element-type FluDevice]

flu_device_type_name_get ()

const gchar *
flu_device_type_name_get (FluDeviceType type);

Returns a human-readable string describing a device category

Parameters

type

The FluDevice type

 

Returns

The device category name


flu_device_type_get ()

FluDeviceType
flu_device_type_get (const FluDevice *device);

Category this device belongs to

Parameters

device

The FluDevice

 

Returns

The device's FluDeviceType


flu_device_name_get ()

const gchar *
flu_device_name_get (const FluDevice *device);

A human-readable name of the device. Some devices might return a unique identifier instead.

Parameters

device

The FluDevice

 

Returns

The device name, or NULL


flu_device_uri_get ()

const gchar *
flu_device_uri_get (const FluDevice *device);

Device URI

Could be dvd:///dev/dvd on Linux or dvd://\\.\D: on Windows, for example. Not all devices have a URI.

Parameters

device

The FluDevice

 

Returns

The device's URI, or NULL


flu_device_label_get ()

const gchar *
flu_device_label_get (const FluDevice *device);

Media label read from the device. Not available for all kinds of media. Mostly human-readable.

Parameters

device

The FluDevice

 

Returns

The device's current media label, or NULL


flu_device_current_media_id_get ()

const gchar *
flu_device_current_media_id_get (const FluDevice *device);

Unique ID for the media currently inserted in the device (for devices with removable media, like DVDs, for example) or the name of the GStreamer plugin used to provide a device interface (for hardware devices like a camera or a microphone, for example).

In case of removable media, it is a 128-bit MD5 string (16 chars), NULL-terminated for convenience.

Parameters

device

The FluDevice

 

Returns

The device's current media ID or gstreamer plugin name


flu_device_is_fake ()

gboolean
flu_device_is_fake (const FluDevice *device);

Gets the information if device is a fake software device or a real hardware device. Useful to identify a real camera or microphone from emulated devices, for example.

Parameters

device

The FluDevice

 

Returns

TRUE if device is fake, FALSE otherwise


flu_device_output_formats_get ()

const GList *
flu_device_output_formats_get (FluDevice *device);

Gets a list of output formats provided by this device.

Parameters

device

The FluDevice

 

Returns

The list of available output formats. If you need to keep a FluStreamInfo data beyond the lifetime of the FluDevice instance, you can use flu_stream_info_copy() to copy them to a local instance. Don't forget to call flu_stream_info_clear() later on your local instance to free up memory.

[element-type FluStreamInfo][transfer none]


flu_device_config_clear ()

void
flu_device_config_clear (FluDeviceConfig *config);

Clear (initialize to default values) a FluDeviceConfig structure and frees associated memory.

Parameters

config

The information to clear

 

flu_device_config_copy ()

void
flu_device_config_copy (FluDeviceConfig *target,
                        const FluDeviceConfig *src);

Copy the information of a device configuration. This function will copy data from a source FluDeviceConfig into a target structure. While doing so it will first free the members of target to avoid memory leaks. Target does not need to be of the same type as src.

WARNING: Use flu_device_config_clear() to clear and free the information of the struct

Parameters

target

The FluDeviceConfig to write the information to

 

src

The FluDeviceConfig to copy the information from

 

flu_device_config_set ()

gboolean
flu_device_config_set (FluDevice *device,
                       const FluDeviceConfig *device_config);

WARNING: actual device configuration values are read when connecting the device to a recorder or opening it from a player. Calling flu_device_config_set() AFTER flu_recorder_connect_device() or flu_player_device_open() WILL NOT change recorder or player configurations.

Parameters

device

The FluDevice to configure

 

device_config

The device configuration to set.

[transfer none]

Returns

TRUE if device has been correctly configured or FALSE otherwise (if device is not configurable or configuration doesn't correspond to the device type, for example)


flu_device_config_get ()

const FluDeviceConfig *
flu_device_config_get (const FluDevice *device);

Gets device configuration or NULL if device is not configurable.

Parameters

device

The FluDevice to get configuration from

 

Returns

Device FluDeviceConfig configuration or NULL if device is not configurable. If you need to keep FluDeviceConfig data beyond the lifetime of the FluDevice instance, you can use flu_device_config_copy() to copy them to a local instance. Don't forget to call flu_device_config_clear() later on your local instance to free up memory.

[transfer none]

Types and Values

enum FluDeviceType

Device categories, useful for searching for a specific device or using device-type-specific API

Members

FLU_DEVICE_TYPE_UNKNOWN

Unknown device type

 

FLU_DEVICE_TYPE_DVD_DRIVE

A DVD drive

 

FLU_DEVICE_TYPE_CAMERA

A video camera

 

FLU_DEVICE_TYPE_SCREEN_CAPTURE

A monitor screen which content can be captured. Useful for recording game sessions or video tutorials.

 

FLU_DEVICE_TYPE_MICROPHONE

An audio recording device

 

FLU_DEVICE_TYPE_APP_CAPTURE

A video surface captured from an application identified by its process ID (PID).

 

enum FluDeviceConfigAppCapturePlatform

Members

FLU_DEVICE_CONFIG_APP_CAPTURE_PLATFORM_AUTO

   

FLU_DEVICE_CONFIG_APP_CAPTURE_PLATFORM_32

   

FLU_DEVICE_CONFIG_APP_CAPTURE_PLATFORM_64

   

enum FluDeviceConfigAppCaptureApi

Members

FLU_DEVICE_CONFIG_APP_CAPTURE_API_AUTO

Automatically guess application API

 

FLU_DEVICE_CONFIG_APP_CAPTURE_API_DX9

Application is using DirectX 9

 

FLU_DEVICE_CONFIG_APP_CAPTURE_API_DX11

Application is using DirectX 11

 

FLU_DEVICE_CONFIG_APP_CAPTURE_API_DX12

Application is using DirectX 12

 

enum FluDeviceConfigAppCaptureInjectMode

Members

FLU_DEVICE_CONFIG_APP_CAPTURE_INJECT_MODE_STANDARD

Standard injection mode

 

FLU_DEVICE_CONFIG_APP_CAPTURE_INJECT_MODE_STEALTH

Stealth injection mode

 

FluDeviceConfigAppCapture

typedef struct {
  gint pid;
  FluDeviceConfigAppCapturePlatform platform;
  FluDeviceConfigAppCaptureApi api;
  FluDeviceConfigAppCaptureInjectMode inject_mode;
  gchar *installation_dir;
} FluDeviceConfigAppCapture;

Configuration structure for application capture devices.

Members

gint pid;

Process ID of the application to capture

 

FluDeviceConfigAppCapturePlatform platform;

   

FluDeviceConfigAppCaptureApi api;

Graphics API used by the application to capture

 

FluDeviceConfigAppCaptureInjectMode inject_mode;

Injection mode used to capture application

 

gchar *installation_dir;

Installation directory used to find the injector

 

FluDeviceConfigData

Generic configuration data for each configurable device type. Used only in FluDeviceConfig.

Members

FluDeviceConfigAppCapture app_capture;

Configuration for application capture devices (use only if type is FLU_DEVICE_TYPE_APP_CAPTURE)

 

FluDeviceConfig

typedef struct {
  FluDeviceType type;
  FluStreamInfo output_format;
  FluDeviceConfigData data;
} FluDeviceConfig;

Members

FluDeviceType type;

The FluDeviceType of the device

 

FluStreamInfo output_format;

Configuration of the device output format

 

FluDeviceConfigData data;

Union providing type specific configuration

 

FluDevice

typedef struct {
} FluDevice;

An opaque structure representing a hardware device. Obtain the list of available devices using flu_device_list_get() and examine each one through the different flu_device_*_get() methods. You also receive an FluDevice in the FLU_EVENT_TYPE_NEW_MEDIA_AVAILABLE and FLU_EVENT_TYPE_MEDIA_REMOVED events.