Add --no-xwindow option to not to create xwindow. Also fix zoom and
mute option types and filename string handling.
- Compile using:
- gcc -Wall `pkg-config --cflags --libs gstreamer-0.10` gst-camerabin-test.c -o gst-camerabin-test
-
Examples:
./gst-camerabin-test --image-width=2048 --image-height=1536 --image-enc=dspjpegenc
./gst-camerabin-test --mode=1 --capture-time=10 --image-width=848 --image-height=480 --view-framerate-num=2825 \
--view-framerate-den=100 --audio-src=pulsesrc --audio-enc=nokiaaacenc --video-enc=dspmp4venc \
--video-mux=mp4mux --src-colorspace=UYVY
Examples:
./gst-camerabin-test --image-width=2048 --image-height=1536 --image-enc=dspjpegenc
./gst-camerabin-test --mode=1 --capture-time=10 --image-width=848 --image-height=480 --view-framerate-num=2825 \
--view-framerate-den=100 --audio-src=pulsesrc --audio-enc=nokiaaacenc --video-enc=dspmp4venc \
--video-mux=mp4mux --src-colorspace=UYVY
- ./gst-camerabin-test --help
+ gst-camerabin-test --help
Usage:
gst-camerabin-test [OPTION...]
Usage:
gst-camerabin-test [OPTION...]
- camerabin command line test application
+ camerabin command line test application.
Help Options:
-h, --help Show help options
Help Options:
-h, --help Show help options
--directory Directory for capture file(s) (default is current directory)
--mode Capture mode (default = 0 (image), 1 = video)
--capture-time Time to capture video in seconds (default = 10)
--directory Directory for capture file(s) (default is current directory)
--mode Capture mode (default = 0 (image), 1 = video)
--capture-time Time to capture video in seconds (default = 10)
- --capture-total Total number of captures to be done
+ --capture-total Total number of captures to be done (default = 1)
--flags Flags for camerabin, (default = 0x9)
--flags Flags for camerabin, (default = 0x9)
- --mute Mute audio (default = 0 (no))
--zoom Zoom (100 = 1x (default), 200 = 2x etc.)
--audio-src Audio source used in video recording
--audio-bitrate Audio bitrate (default 128000)
--zoom Zoom (100 = 1x (default), 200 = 2x etc.)
--audio-src Audio source used in video recording
--audio-bitrate Audio bitrate (default 128000)
--image-height Height for image capture
--view-framerate-num Framerate numerator for viewfinder
--view-framerate-den Framerate denominator for viewfinder
--image-height Height for image capture
--view-framerate-num Framerate numerator for viewfinder
--view-framerate-den Framerate denominator for viewfinder
- --src-colorspace Colorspace format for videosource (e.g. YUY2, UYVY)
+ --src-colorspace Colorspace format for video source (e.g. YUY2, UYVY)
+ --src-format Video format for video source
--preview-caps Preview caps (e.g. video/x-raw-rgb,width=320,height=240)
--preview-caps Preview caps (e.g. video/x-raw-rgb,width=320,height=240)
- --video-source-filter Video filter to process all frames from video source
+ --video-source-filter Video filter to process all frames from video source
--viewfinder-filter Filter to process all frames going to viewfinder sink
--viewfinder-filter Filter to process all frames going to viewfinder sink
+ --x-width X window width (default = 320)
+ --x-height X window height (default = 240)
+ --no-xwindow Do not create XWindow
static gint image_height = 720;
static gint view_framerate_num = 2825;
static gint view_framerate_den = 100;
static gint image_height = 720;
static gint view_framerate_num = 2825;
static gint view_framerate_den = 100;
+static gboolean no_xwindow = FALSE;
/* photography interface command line options */
static gfloat ev_compensation = 0.0;
/* photography interface command line options */
static gfloat ev_compensation = 0.0;
static gint color_mode = 0;
static gint mode = 1;
static gint flags = 0x4f;
static gint color_mode = 0;
static gint mode = 1;
static gint flags = 0x4f;
+static gboolean mute = FALSE;
static gint zoom = 100;
static gint capture_time = 10;
static gint zoom = 100;
static gint capture_time = 10;
st = gst_message_get_structure (message);
if (st) {
if (gst_structure_has_name (message->structure, "prepare-xwindow-id")) {
st = gst_message_get_structure (message);
if (st) {
if (gst_structure_has_name (message->structure, "prepare-xwindow-id")) {
+ if (!no_xwindow && window) {
gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC
(message)), window);
gst_message_unref (message);
gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC
(message)), window);
gst_message_unref (message);
g_warning ("can't set camerabin to playing\n");
goto error;
}
g_warning ("can't set camerabin to playing\n");
goto error;
}
GST_INFO_OBJECT (camera_bin, "camera started");
return TRUE;
error:
GST_INFO_OBJECT (camera_bin, "camera started");
return TRUE;
error:
run_pipeline (gpointer user_data)
{
GstCaps *preview_caps = NULL;
run_pipeline (gpointer user_data)
{
GstCaps *preview_caps = NULL;
+ gchar *filename_str = NULL;
+ GString *filename_buffer = NULL;
g_object_set (camera_bin, "mode", mode, NULL);
g_object_set (camera_bin, "mode", mode, NULL);
set_metadata (camera_bin);
set_metadata (camera_bin);
- if (capture_total) {
- gchar *filename_str = filename->str;
- filename_str = g_strdup_printf ("%s%d", filename->str, capture_count);
- g_object_set (camera_bin, "filename", filename_str, NULL);
- g_free (filename_str);
- } else {
- g_object_set (camera_bin, "filename", filename->str, NULL);
- }
+ filename_str = g_strdup_printf ("/test_%04u", capture_count);
+ filename_buffer = g_string_new (filename->str);
+ filename_buffer = g_string_append (filename_buffer, filename_str);
+
+ if (mode == 1)
+ filename_buffer = g_string_append (filename_buffer, ".mp4");
+ else
+ filename_buffer = g_string_append (filename_buffer, ".jpg");
+
+ g_object_set (camera_bin, "filename", filename_buffer->str, NULL);
+ g_string_free (filename_buffer, FALSE);
+ g_free (filename_str);
+
g_object_set (camera_bin, "ev-compensation", ev_compensation, NULL);
g_object_set (camera_bin, "aperture", aperture, NULL);
g_object_set (camera_bin, "ev-compensation", ev_compensation, NULL);
g_object_set (camera_bin, "aperture", aperture, NULL);
"Total number of captures to be done (default = 1)", NULL},
{"flags", '\0', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_INT, &flags,
"Flags for camerabin, (default = 0x9)", NULL},
"Total number of captures to be done (default = 1)", NULL},
{"flags", '\0', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_INT, &flags,
"Flags for camerabin, (default = 0x9)", NULL},
- {"mute", '\0', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_STRING, &mute,
- "Mute audio (default = 0 (no))", NULL},
- {"zoom", '\0', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_STRING, &zoom,
+ {"mute", '\0', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_NONE, &mute,
+ "Mute audio", NULL},
+ {"zoom", '\0', G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_INT, &zoom,
"Zoom (100 = 1x (default), 200 = 2x etc.)", NULL},
{"audio-src", '\0', 0, G_OPTION_ARG_STRING, &audiosrc_name,
"Audio source used in video recording", NULL},
"Zoom (100 = 1x (default), 200 = 2x etc.)", NULL},
{"audio-src", '\0', 0, G_OPTION_ARG_STRING, &audiosrc_name,
"Audio source used in video recording", NULL},
"X window width (default = 320)", NULL},
{"x-height", '\0', 0, G_OPTION_ARG_INT, &x_height,
"X window height (default = 240)", NULL},
"X window width (default = 320)", NULL},
{"x-height", '\0', 0, G_OPTION_ARG_INT, &x_height,
"X window height (default = 240)", NULL},
+ {"no-xwindow", '\0', 0, G_OPTION_ARG_NONE, &no_xwindow,
+ "Do not create XWindow", NULL},
GError *err = NULL;
/* if we fail to create xwindow should we care? */
GError *err = NULL;
/* if we fail to create xwindow should we care? */
+ if (!no_xwindow)
+ create_host_window ();
if (!g_thread_supported ())
g_thread_init (NULL);
if (!g_thread_supported ())
g_thread_init (NULL);
if (filename->len == 0)
filename = g_string_append (filename, ".");
if (filename->len == 0)
filename = g_string_append (filename, ".");
- filename = g_string_append (filename, "/test_%04u");
- if (mode == 1)
- filename = g_string_append (filename, ".mp4");
- else
- filename = g_string_append (filename, ".jpg");
-
/* init */
if (setup_pipeline ()) {
loop = g_main_loop_new (NULL, FALSE);
/* init */
if (setup_pipeline ()) {
loop = g_main_loop_new (NULL, FALSE);