Commit a31a56ab authored by Justin Kim's avatar Justin Kim

ahc2src: Add n-cameras property

parent 4b83cac2
......@@ -137,6 +137,7 @@ G_DEFINE_TYPE_WITH_CODE (GstAHC2Src, gst_ahc2_src, GST_TYPE_PUSH_SRC,
typedef enum
{
PROP_CAMERA_INDEX = 1,
PROP_N_CAMERAS,
PROP_CAMERA_TEMPLATE_TYPE,
PROP_MAX_IMAGES,
......@@ -172,7 +173,6 @@ static GParamSpec *properties[PROP_LAST + 1];
enum
{
SIG_GET_CAMERA_COUNT,
SIG_GET_CAMERA_ID_BY_INDEX,
LAST_SIGNAL
};
......@@ -1541,6 +1541,14 @@ gst_ahc2_src_get_property (GObject * object,
case PROP_CAMERA_INDEX:
g_value_set_int (value, priv->camera_index);
break;
case PROP_N_CAMERAS:
if (priv->camera_id_list != NULL) {
g_value_set_int (value, priv->camera_id_list->numCameras);
} else {
GST_WARNING_OBJECT (self, "Camera list doesn't exist.");
g_value_set_int (value, 0);
}
break;
case PROP_CAMERA_TEMPLATE_TYPE:
g_value_set_int (value, priv->camera_template_type);
break;
......@@ -1782,16 +1790,6 @@ capture_session_on_active (void *context, ACameraCaptureSession * session)
ACameraDevice_getId (priv->camera_device));
}
static gint
gst_ahc2_src_get_camera_count (GstAHC2Src * self)
{
GstAHC2SrcPrivate *priv = GST_AHC2_SRC_GET_PRIVATE (self);
g_return_val_if_fail (priv->camera_id_list != NULL, -1);
return priv->camera_id_list->numCameras;
}
static const gchar *
gst_ahc2_src_get_camera_id_by_index (GstAHC2Src * self, gint idx)
{
......@@ -1825,6 +1823,16 @@ gst_ahc2_src_class_init (GstAHC2SrcClass * klass)
"The camera device index to open", 0, G_MAXINT, 0,
G_PARAM_READWRITE | GST_PARAM_MUTABLE_READY | G_PARAM_STATIC_STRINGS);
/**
* GstAHC2Src:n-cameras:
*
* The number of connected camera devices.
*/
properties[PROP_CAMERA_INDEX] =
g_param_spec_int ("n-cameras", "Number of Cameras",
"The number of connected camera devices", 0, G_MAXINT, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
/**
* GstAHC2Src:camera-template-type:
* The suitable template type for the purpose of running camera.
......@@ -1964,11 +1972,6 @@ gst_ahc2_src_class_init (GstAHC2SrcClass * klass)
properties[PROP_ZOOM] = g_object_class_find_property (gobject_class,
GST_PHOTOGRAPHY_PROP_ZOOM);
signals[SIG_GET_CAMERA_COUNT] =
g_signal_new ("get-camera-count", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstAHC2SrcClass,
get_camera_count), NULL, NULL, NULL, G_TYPE_INT, 0, G_TYPE_NONE);
signals[SIG_GET_CAMERA_ID_BY_INDEX] =
g_signal_new ("get-camera-id-by-index", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstAHC2SrcClass,
......@@ -1991,7 +1994,6 @@ gst_ahc2_src_class_init (GstAHC2SrcClass * klass)
gstpushsrc_class->create = GST_DEBUG_FUNCPTR (gst_ahc2_src_create);
klass->get_camera_count = gst_ahc2_src_get_camera_count;
klass->get_camera_id_by_index = gst_ahc2_src_get_camera_id_by_index;
}
......
......@@ -47,7 +47,6 @@ struct _GstAHC2SrcClass {
GstPushSrcClass parent_class;
/* actions */
gint (*get_camera_count) (GstAHC2Src *self);
const gchar* (*get_camera_id_by_index) (GstAHC2Src *self, gint idx);
gpointer _gst_reserved[GST_PADDING_LARGE];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment