camerabin2: examples: Allow free image dimensions
Changes the default width/height of captures so that it will be autopicked by camerabin2 instead of hardcoding an option
This commit is contained in:
parent
7847f6497b
commit
ce45c15200
@ -111,10 +111,10 @@ static GMainLoop *loop = NULL;
|
|||||||
static gchar *videosrc_name = NULL;
|
static gchar *videosrc_name = NULL;
|
||||||
static gchar *imagepp_name = NULL;
|
static gchar *imagepp_name = NULL;
|
||||||
static gchar *vfsink_name = NULL;
|
static gchar *vfsink_name = NULL;
|
||||||
static gint image_width = 1280;
|
static gint image_width = 0;
|
||||||
static gint image_height = 720;
|
static gint image_height = 0;
|
||||||
static gint view_framerate_num = 2825;
|
static gint view_framerate_num = 0;
|
||||||
static gint view_framerate_den = 100;
|
static gint view_framerate_den = 0;
|
||||||
static gboolean no_xwindow = FALSE;
|
static gboolean no_xwindow = FALSE;
|
||||||
|
|
||||||
#define MODE_VIDEO 2
|
#define MODE_VIDEO 2
|
||||||
@ -380,6 +380,9 @@ setup_pipeline_element (GstElement * element, const gchar * property_name,
|
|||||||
if (element_name) {
|
if (element_name) {
|
||||||
elem = gst_element_factory_make (element_name, NULL);
|
elem = gst_element_factory_make (element_name, NULL);
|
||||||
if (elem) {
|
if (elem) {
|
||||||
|
if (g_object_class_find_property (G_OBJECT_GET_CLASS (elem), "device")) {
|
||||||
|
g_object_set (elem, "device", "/dev/video1", NULL);
|
||||||
|
}
|
||||||
g_object_set (element, property_name, elem, NULL);
|
g_object_set (element, property_name, elem, NULL);
|
||||||
} else {
|
} else {
|
||||||
GST_WARNING ("can't create element '%s' for property '%s'", element_name,
|
GST_WARNING ("can't create element '%s' for property '%s'", element_name,
|
||||||
@ -450,6 +453,7 @@ setup_pipeline (void)
|
|||||||
GST_INFO_OBJECT (camerabin, "elements configured");
|
GST_INFO_OBJECT (camerabin, "elements configured");
|
||||||
|
|
||||||
/* configure a resolution and framerate */
|
/* configure a resolution and framerate */
|
||||||
|
if (image_width > 0 && image_height > 0) {
|
||||||
if (mode == MODE_VIDEO) {
|
if (mode == MODE_VIDEO) {
|
||||||
GstCaps *caps = NULL;
|
GstCaps *caps = NULL;
|
||||||
if (view_framerate_num > 0)
|
if (view_framerate_num > 0)
|
||||||
@ -484,6 +488,7 @@ setup_pipeline (void)
|
|||||||
g_object_set (camerabin, "image-capture-caps", caps, NULL);
|
g_object_set (camerabin, "image-capture-caps", caps, NULL);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (GST_STATE_CHANGE_FAILURE ==
|
if (GST_STATE_CHANGE_FAILURE ==
|
||||||
gst_element_set_state (camerabin, GST_STATE_READY)) {
|
gst_element_set_state (camerabin, GST_STATE_READY)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user