static void gst_directsound_src_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstDirectSoundSrc * src = GST_DIRECTSOUND_SRC (object); switch (prop_id) { /*case ARG_VOLUME: g_value_set_double (value, sink->volume); break;*/ case ARG_DEVICE: if (!src->device_id) device_set_default (src); g_value_set_string (value, src->device_id); break; case ARG_DEVICE_NAME: if (!src->device_name) device_get_name (src); g_value_set_string (value, src->device_name); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
static gboolean device_select (GstOSXVideoSrc * src) { Str63 pstr; ComponentResult err; gchar *sgname; int inputIndex; /* if there's no device id set, attempt to select default device */ if (!src->device_id && !device_set_default (src)) return FALSE; if (!parse_device_id (src->device_id, &sgname, &inputIndex)) { GST_ERROR_OBJECT (src, "unable to parse device id: [%s]", src->device_id); return FALSE; } c2pstrcpy (pstr, sgname); g_free (sgname); err = SGSetChannelDevice (src->video_chan, (StringPtr) & pstr); if (err != noErr) { GST_ERROR_OBJECT (src, "SGSetChannelDevice returned %d", (int) err); return FALSE; } err = SGSetChannelDeviceInput (src->video_chan, inputIndex); if (err != noErr) { GST_ERROR_OBJECT (src, "SGSetChannelDeviceInput returned %d", (int) err); return FALSE; } return TRUE; }
static gboolean device_get_name (GstOSXVideoSrc * src) { GList *l, *list; video_device *dev; gboolean ret; /* if there is no device set, then attempt to set up with the default, * which will also grab the name in the process. */ if (!src->device_id) return device_set_default (src); /* if we already have a name, free it */ if (src->device_name) { g_free (src->device_name); src->device_name = NULL; } /* obtain the device list */ list = device_list (src); if (!list) return FALSE; ret = FALSE; /* look up the id */ for (l = list; l != NULL; l = l->next) { dev = (video_device *) l->data; if (g_str_equal (dev->id, src->device_id)) { /* take the string, no need to copy */ src->device_name = dev->name; dev->name = NULL; ret = TRUE; break; } } g_list_foreach (list, video_device_free_func, NULL); g_list_free (list); return ret; }
static void gst_osx_video_src_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstOSXVideoSrc *src = GST_OSX_VIDEO_SRC (object); switch (prop_id) { case ARG_DEVICE: if (!src->device_id) device_set_default (src); g_value_set_string (value, src->device_id); break; case ARG_DEVICE_NAME: if (!src->device_name) device_get_name (src); g_value_set_string (value, src->device_name); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }