#ifndef _AUDIO_SOURCES #define _AUDIO_SOURCES #include #include #include #define DEFAULT_AUDIO_SOURCE "pulsesrc" // Types of audio devices (audio sources) enum DeviceType { NOT_DEFINED = 0x0, DEFAULT_DEVICE = 0x1, // GNOME-desktop's default device. Defined as "gconfaudiosrc" or "autoaudiosrc". AUDIO_SINK = 0x2, // Real audio card with sound output, audio sink. This is an audio-card with loudspeakers. Useless for recording. AUDIO_SINK_MONITOR = 0x4, // This is the monitor device for AUDIO_SINK. We use this to record from an audio-card (think loudspeakers). AUDIO_INPUT = 0x8, // Standalone microphone or webcam with microphone. Many audio-cards have also microphone input. MEDIA_PLAYER = 0x10, // DBus entity. Media Players like RhythmBox, Amarok and Banshee. These can control the recording via DBus. COMM_PROGRAM = 0x20, // DBus entity. Communication program like Skype. Skype can control the recording via DBus. USER_DEFINED = 0x40 // User-defined group of devices. User can create a group of devices (eg. several microphones) and record from'em. }; typedef struct { enum DeviceType type; // Device type. See above. gint index; // Pulseaudio.c: this value is pulseaudio's pa_source_info->index or pa_sink_info->index. // Ref: http://freedesktop.org/software/pulseaudio/doxygen/structpa__sink__info.html gchar *id; // Internal device id (audio device id). In Pulseaudio this field is called "name". gchar *description; // Human readable device description shown in listboxes. gint sink_index; // Pulseaudio.c: this value is pulseaudio's pa_source_info->monitor_of_sink. This points to another // DeviceItem where DeviceItem->index = DeviceItem->sink_index. We simply need this to get the audio cards real name! gchar *icon_name; // Icon name for this device type } DeviceItem; DeviceItem *device_item_create(gchar *id, gchar *description); DeviceItem *device_item_copy_node(DeviceItem *item); void device_item_free(DeviceItem *item); const gchar *device_item_get_type_name(guint type); // ComboBox columns enum { COL_DEVICE_TYPE, // DeviceType (see above), hidden column COL_DEVICE_ID, // Device ID, hidden column COL_DEVICE_ICON, // Device icon, visible COL_DEVICE_DESCR, // Device description, visible column N_DEVICE_COLUMNS // Number of columns in the combobox }; gboolean filter_for_sink_dev(DeviceItem *item); void audio_sources_init(); void audio_sources_exit(); void audio_sources_reload_device_list(); void audio_sources_free_list(GList *lst); void audio_sources_print_list(GList *list, gchar *tag); void audio_sources_print_list_ex(); GList *audio_sources_get_for_type(gint type); DeviceItem *audio_sources_find_id(gchar *device_id); void audio_sources_device_changed(gchar *device_id); GList *audio_sources_wash_device_list(GList *dev_list); GList *audio_sources_get_device_NEW(gchar **audio_source); GtkWidget *audio_sources_create_combo(); void audio_source_fill_combo(GtkWidget *combo); void audio_sources_combo_set_id(GtkWidget *combo, gchar *device_id); gint audio_sources_get_combo_index(GtkWidget *combo); gboolean audio_sources_combo_get_values(GtkWidget *combo, gchar **device_name, gchar **device_id, gint *device_type); gboolean audio_sources_device_is_webcam(gchar *dev_name); #endif