[cheese] reindent code to meet our standards
- From: Daniel G. Siegel <dgsiegel src gnome org>
- To: svn-commits-list gnome org
- Subject: [cheese] reindent code to meet our standards
- Date: Mon, 22 Jun 2009 06:58:37 -0400 (EDT)
commit 44c6c73baf113e4e3d71a9f71baceaa309f9ffc9
Author: daniel g. siegel <dgsiegel gnome org>
Date: Mon Jun 22 12:56:30 2009 +0200
reindent code to meet our standards
src/cheese-countdown.c | 4 +-
src/cheese-effect-chooser.c | 4 +-
src/cheese-gconf.c | 3 +-
src/cheese-prefs-balance-scale.c | 35 +++++-----
src/cheese-prefs-balance-scale.h | 13 ++--
src/cheese-prefs-dialog.c | 28 ++++----
src/cheese-thumb-view.c | 23 +++---
src/cheese-webcam.c | 147 +++++++++++++++++++++-----------------
src/cheese-webcam.h | 12 ++--
src/cheese-window.c | 49 +++++++------
src/cheese.c | 5 +-
11 files changed, 173 insertions(+), 150 deletions(-)
---
diff --git a/src/cheese-countdown.c b/src/cheese-countdown.c
index 810ed4f..151a901 100644
--- a/src/cheese-countdown.c
+++ b/src/cheese-countdown.c
@@ -564,8 +564,8 @@ create_surface_from_svg (GtkWidget *widget, gchar *pcFilename)
static void
on_style_set_cb (GtkWidget *widget, GtkStyle *previous_style, gpointer data)
{
- CheeseCountdownPrivate *priv = CHEESE_COUNTDOWN_GET_PRIVATE (data);
- GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (widget));
+ CheeseCountdownPrivate *priv = CHEESE_COUNTDOWN_GET_PRIVATE (data);
+ GtkStyle *style = gtk_widget_get_style (GTK_WIDGET (widget));
GdkColor *color_bg = &style->bg[GTK_STATE_SELECTED];
GdkColor *color_text = &style->fg[GTK_STATE_SELECTED];
diff --git a/src/cheese-effect-chooser.c b/src/cheese-effect-chooser.c
index 41e816d..3acab07 100644
--- a/src/cheese-effect-chooser.c
+++ b/src/cheese-effect-chooser.c
@@ -236,8 +236,8 @@ cheese_effect_chooser_button_press_event_cb (GtkWidget *widget, GdkEventButton *
CheeseEffectChooserPrivate *priv = CHEESE_EFFECT_CHOOSER_GET_PRIVATE (widget);
int i;
- int col = (int) (button_event->x / widget->allocation.width * BOARD_COLS);
- int row = (int) (button_event->y / widget->allocation.height * BOARD_ROWS);
+ int col = (int) (button_event->x / widget->allocation.width * BOARD_COLS);
+ int row = (int) (button_event->y / widget->allocation.height * BOARD_ROWS);
int slot = (row * BOARD_COLS + col);
priv->selected[slot] = !priv->selected[slot];
diff --git a/src/cheese-gconf.c b/src/cheese-gconf.c
index bf6e061..d2bda4d 100644
--- a/src/cheese-gconf.c
+++ b/src/cheese-gconf.c
@@ -92,7 +92,8 @@ cheese_gconf_get_property (GObject *object, guint prop_id, GValue *value,
}
if (effects == NULL)
effects = g_strdup (str);
- else {
+ else
+ {
gchar *dummy = effects;
effects = g_strjoin (",", effects, str, NULL);
g_free (dummy);
diff --git a/src/cheese-prefs-balance-scale.c b/src/cheese-prefs-balance-scale.c
index 036fc96..cb0e159 100644
--- a/src/cheese-prefs-balance-scale.c
+++ b/src/cheese-prefs-balance-scale.c
@@ -54,8 +54,8 @@ cheese_prefs_balance_scale_init (CheesePrefsBalanceScale *self)
{
CheesePrefsBalanceScalePrivate *priv = CHEESE_PREFS_BALANCE_SCALE_GET_PRIVATE (self);
- priv->property_name = NULL;
- priv->gconf_key = NULL;
+ priv->property_name = NULL;
+ priv->gconf_key = NULL;
priv->has_been_synchronized = FALSE;
}
@@ -74,8 +74,9 @@ cheese_prefs_balance_scale_finalize (GObject *object)
static void
cheese_prefs_balance_scale_value_changed (GtkRange *scale, CheesePrefsBalanceScale *self)
{
- CheesePrefsBalanceScalePrivate *priv = CHEESE_PREFS_BALANCE_SCALE_GET_PRIVATE (self);
- gdouble value = gtk_range_get_value (scale);
+ CheesePrefsBalanceScalePrivate *priv = CHEESE_PREFS_BALANCE_SCALE_GET_PRIVATE (self);
+ gdouble value = gtk_range_get_value (scale);
+
cheese_webcam_set_balance_property (priv->webcam, priv->property_name, value);
g_object_set (CHEESE_PREFS_WIDGET (self)->gconf, priv->gconf_key, value, NULL);
@@ -89,17 +90,17 @@ cheese_prefs_balance_scale_synchronize (CheesePrefsWidget *prefs_widget)
CheesePrefsBalanceScale *self = CHEESE_PREFS_BALANCE_SCALE (prefs_widget);
CheesePrefsBalanceScalePrivate *priv = CHEESE_PREFS_BALANCE_SCALE_GET_PRIVATE (self);
- GtkWidget *scale;
- GtkAdjustment *adj;
- gdouble min, max, def;
- gdouble stored_value;
+ GtkWidget *scale;
+ GtkAdjustment *adj;
+ gdouble min, max, def;
+ gdouble stored_value;
g_object_get (prefs_widget, "widget", &scale, NULL);
- cheese_webcam_get_balance_property_range (priv->webcam,
+ cheese_webcam_get_balance_property_range (priv->webcam,
priv->property_name, &min, &max, &def);
- adj = GTK_ADJUSTMENT (gtk_adjustment_new (def, min, max, (max - min)/STEPS, 0.0, 0.0));
+ adj = GTK_ADJUSTMENT (gtk_adjustment_new (def, min, max, (max - min) / STEPS, 0.0, 0.0));
gtk_range_set_adjustment (GTK_RANGE (scale), adj);
gtk_scale_add_mark (GTK_SCALE (scale), def, GTK_POS_BOTTOM, NULL);
@@ -107,7 +108,7 @@ cheese_prefs_balance_scale_synchronize (CheesePrefsWidget *prefs_widget)
g_object_get (CHEESE_PREFS_WIDGET (self)->gconf, priv->gconf_key, &stored_value, NULL);
gtk_range_set_value (GTK_RANGE (scale), stored_value);
-
+
/* Disconnect to prevent a whole bunch of changed notifications */
g_signal_handlers_disconnect_by_func (scale, cheese_prefs_balance_scale_value_changed, prefs_widget);
@@ -118,8 +119,8 @@ cheese_prefs_balance_scale_synchronize (CheesePrefsWidget *prefs_widget)
static void
cheese_prefs_balance_scale_set_property (GObject *object, guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+ const GValue *value,
+ GParamSpec *pspec)
{
CheesePrefsBalanceScalePrivate *priv = CHEESE_PREFS_BALANCE_SCALE_GET_PRIVATE (object);
@@ -144,7 +145,7 @@ cheese_prefs_balance_scale_set_property (GObject *object, guint prop_id,
static void
cheese_prefs_balance_scale_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
+ GValue *value, GParamSpec *pspec)
{
CheesePrefsBalanceScalePrivate *priv = CHEESE_PREFS_BALANCE_SCALE_GET_PRIVATE (object);
@@ -206,10 +207,10 @@ cheese_prefs_balance_scale_class_init (CheesePrefsBalanceScaleClass *klass)
}
CheesePrefsBalanceScale *
-cheese_prefs_balance_scale_new (GtkWidget *scale,
+cheese_prefs_balance_scale_new (GtkWidget *scale,
CheeseWebcam *webcam,
- const gchar *property,
- const gchar *gconf_key)
+ const gchar *property,
+ const gchar *gconf_key)
{
CheesePrefsBalanceScale *self;
CheesePrefsBalanceScalePrivate *priv;
diff --git a/src/cheese-prefs-balance-scale.h b/src/cheese-prefs-balance-scale.h
index fda4a78..21c261c 100644
--- a/src/cheese-prefs-balance-scale.h
+++ b/src/cheese-prefs-balance-scale.h
@@ -28,12 +28,13 @@ G_BEGIN_DECLS
#define CHEESE_TYPE_PREFS_BALANCE_SCALE (cheese_prefs_balance_scale_get_type ())
#define CHEESE_PREFS_BALANCE_SCALE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CHEESE_TYPE_PREFS_BALANCE_SCALE, \
- CheesePrefsBalanceScale))
+ CheesePrefsBalanceScale))
#define CHEESE_PREFS_BALANCE_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CHEESE_TYPE_PREFS_BALANCE_SCALE, \
- CheesePrefsBalanceScaleClass))
+ CheesePrefsBalanceScaleClass))
#define CHEESE_IS_PREFS_BALANCE_SCALE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CHEESE_TYPE_PREFS_BALANCE_SCALE))
#define CHEESE_IS_PREFS_BALANCE_SCALE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CHEESE_TYPE_PREFS_BALANCE_SCALE))
-#define CHEESE_PREFS_BALANCE_SCALE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_PREFS_BALANCE_SCALE, CheesePrefsBalanceScaleClass))
+#define CHEESE_PREFS_BALANCE_SCALE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CHEESE_TYPE_PREFS_BALANCE_SCALE, \
+ CheesePrefsBalanceScaleClass))
typedef struct _CheesePrefsBalanceScaleClass CheesePrefsBalanceScaleClass;
typedef struct _CheesePrefsBalanceScale CheesePrefsBalanceScale;
@@ -48,10 +49,10 @@ struct _CheesePrefsBalanceScale
CheesePrefsWidget parent_instance;
};
-GType cheese_prefs_balance_scale_get_type (void) G_GNUC_CONST;
+GType cheese_prefs_balance_scale_get_type (void) G_GNUC_CONST;
CheesePrefsBalanceScale *cheese_prefs_balance_scale_new (GtkWidget *scale,
CheeseWebcam *webcam,
- const gchar *property,
- const gchar *balance_key);
+ const gchar *property,
+ const gchar *balance_key);
#endif /* _CHEESE_PREFS_BALANCE_SCALE_H_ */
diff --git a/src/cheese-prefs-dialog.c b/src/cheese-prefs-dialog.c
index 52b265d..9bb1814 100644
--- a/src/cheese-prefs-dialog.c
+++ b/src/cheese-prefs-dialog.c
@@ -61,11 +61,11 @@ cheese_prefs_dialog_create_dialog (CheesePrefsDialog *prefs_dialog)
prefs_dialog->brightness_scale = GTK_WIDGET (gtk_builder_get_object (builder,
"brightness_scale"));
prefs_dialog->contrast_scale = GTK_WIDGET (gtk_builder_get_object (builder,
- "contrast_scale"));
+ "contrast_scale"));
prefs_dialog->saturation_scale = GTK_WIDGET (gtk_builder_get_object (builder,
- "saturation_scale"));
+ "saturation_scale"));
prefs_dialog->hue_scale = GTK_WIDGET (gtk_builder_get_object (builder,
- "hue_scale"));
+ "hue_scale"));
gtk_window_set_transient_for (GTK_WINDOW (prefs_dialog->cheese_prefs_dialog),
GTK_WINDOW (prefs_dialog->parent));
@@ -117,7 +117,7 @@ cheese_prefs_dialog_setup_widgets (CheesePrefsDialog *prefs_dialog)
CheesePrefsWidget *resolution_widget;
CheesePrefsWidget *webcam_widget;
CheesePrefsWidget *brightness_widget;
- CheesePrefsWidget *contrast_widget;
+ CheesePrefsWidget *contrast_widget;
CheesePrefsWidget *saturation_widget;
CheesePrefsWidget *hue_widget;
@@ -141,26 +141,26 @@ cheese_prefs_dialog_setup_widgets (CheesePrefsDialog *prefs_dialog)
cheese_prefs_dialog_widgets_add (prefs_dialog->widgets, webcam_widget);
brightness_widget = CHEESE_PREFS_WIDGET (cheese_prefs_balance_scale_new (prefs_dialog->brightness_scale,
- prefs_dialog->webcam, "brightness",
- "gconf_prop_brightness"));
+ prefs_dialog->webcam, "brightness",
+ "gconf_prop_brightness"));
cheese_prefs_dialog_widgets_add (prefs_dialog->widgets, brightness_widget);
contrast_widget = CHEESE_PREFS_WIDGET (cheese_prefs_balance_scale_new (prefs_dialog->contrast_scale,
- prefs_dialog->webcam, "contrast",
- "gconf_prop_contrast"));
+ prefs_dialog->webcam, "contrast",
+ "gconf_prop_contrast"));
cheese_prefs_dialog_widgets_add (prefs_dialog->widgets, contrast_widget);
- saturation_widget = CHEESE_PREFS_WIDGET (cheese_prefs_balance_scale_new (prefs_dialog->saturation_scale,
- prefs_dialog->webcam, "saturation",
- "gconf_prop_saturation"));
+ saturation_widget = CHEESE_PREFS_WIDGET (cheese_prefs_balance_scale_new (prefs_dialog->saturation_scale,
+ prefs_dialog->webcam, "saturation",
+ "gconf_prop_saturation"));
cheese_prefs_dialog_widgets_add (prefs_dialog->widgets, saturation_widget);
- hue_widget = CHEESE_PREFS_WIDGET (cheese_prefs_balance_scale_new (prefs_dialog->hue_scale,
- prefs_dialog->webcam, "hue",
- "gconf_prop_hue"));
+ hue_widget = CHEESE_PREFS_WIDGET (cheese_prefs_balance_scale_new (prefs_dialog->hue_scale,
+ prefs_dialog->webcam, "hue",
+ "gconf_prop_hue"));
cheese_prefs_dialog_widgets_add (prefs_dialog->widgets, hue_widget);
diff --git a/src/cheese-thumb-view.c b/src/cheese-thumb-view.c
index c1a5494..0ceaee3 100644
--- a/src/cheese-thumb-view.c
+++ b/src/cheese-thumb-view.c
@@ -84,15 +84,15 @@ cheese_thumb_view_thread_append_item (gpointer data)
CheeseThumbViewPrivate *priv = CHEESE_THUMB_VIEW_GET_PRIVATE (thumb_view);
GnomeDesktopThumbnailFactory *factory = priv->factory;
- GFile *file = item->file;
- GtkTreeIter iter = item->iter;
- GdkPixbuf *pixbuf = NULL;
- GFileInfo *info;
- char *thumb_loc;
- GTimeVal mtime;
- char *mime_type;
- char *uri;
- char *filename;
+ GFile *file = item->file;
+ GtkTreeIter iter = item->iter;
+ GdkPixbuf *pixbuf = NULL;
+ GFileInfo *info;
+ char *thumb_loc;
+ GTimeVal mtime;
+ char *mime_type;
+ char *uri;
+ char *filename;
info = g_file_query_info (file, "standard::content-type,time::modified", 0, NULL, NULL);
@@ -180,7 +180,7 @@ cheese_thumb_view_append_item (CheeseThumbView *thumb_view, GFile *file)
GtkTreePath *path;
char *filename, *basename, *col_filename;
GError *error = NULL;
- gboolean skip = FALSE;
+ gboolean skip = FALSE;
CheeseThumbViewThreadData *data;
@@ -194,7 +194,6 @@ cheese_thumb_view_append_item (CheeseThumbView *thumb_view, GFile *file)
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (priv->store), &iter))
{
-
/* check if the selected item is the first, else go through the store */
gtk_tree_model_get (GTK_TREE_MODEL (priv->store), &iter, THUMBNAIL_URL_COLUMN, &col_filename, -1);
if (g_ascii_strcasecmp (col_filename, filename))
@@ -223,7 +222,7 @@ cheese_thumb_view_append_item (CheeseThumbView *thumb_view, GFile *file)
{
char *f;
- f = g_strdup_printf ("%s/pixmaps/cheese-%i.svg", PACKAGE_DATADIR, g_random_int_range (1, 4));
+ f = g_strdup_printf ("%s/pixmaps/cheese-%i.svg", PACKAGE_DATADIR, g_random_int_range (1, 4));
pixbuf = gdk_pixbuf_new_from_file (f, NULL);
g_free (f);
}
diff --git a/src/cheese-webcam.c b/src/cheese-webcam.c
index 3043425..3a75177 100644
--- a/src/cheese-webcam.c
+++ b/src/cheese-webcam.c
@@ -240,7 +240,8 @@ cheese_webcam_bus_message_cb (GstBus *bus, GstMessage *message, CheeseWebcam *we
if (GST_MESSAGE_TYPE (message) == GST_MESSAGE_EOS)
{
- if (priv->is_recording) {
+ if (priv->is_recording)
+ {
g_print ("Received EOS message\n");
g_source_remove (priv->eos_timeout_id);
@@ -313,13 +314,13 @@ cheese_webcam_get_video_devices_from_hal (CheeseWebcam *webcam)
{
char *device;
char *parent_udi = NULL;
- char *subsystem = NULL;
+ char *subsystem = NULL;
char *gstreamer_src, *product_name;
struct v4l2_capability v2cap;
struct video_capability v1cap;
- gint vendor_id = 0;
- gint product_id = 0;
- gchar *property_name = NULL;
+ gint vendor_id = 0;
+ gint product_id = 0;
+ gchar *property_name = NULL;
parent_udi = libhal_device_get_property_string (hal_ctx, udis[i], "info.parent", &error);
if (dbus_error_is_set (&error))
@@ -328,20 +329,23 @@ cheese_webcam_get_video_devices_from_hal (CheeseWebcam *webcam)
dbus_error_free (&error);
}
- if (parent_udi != NULL) {
+ if (parent_udi != NULL)
+ {
subsystem = libhal_device_get_property_string (hal_ctx, parent_udi, "info.subsystem", NULL);
if (subsystem == NULL) continue;
property_name = g_strjoin (".", subsystem, "vendor_id", NULL);
- vendor_id = libhal_device_get_property_int (hal_ctx, parent_udi, property_name , &error);
- if (dbus_error_is_set (&error)) {
+ vendor_id = libhal_device_get_property_int (hal_ctx, parent_udi, property_name, &error);
+ if (dbus_error_is_set (&error))
+ {
g_warning ("error getting vendor id: %s: %s", error.name, error.message);
dbus_error_free (&error);
}
g_free (property_name);
property_name = g_strjoin (".", subsystem, "product_id", NULL);
- product_id = libhal_device_get_property_int (hal_ctx, parent_udi, property_name, &error);
- if (dbus_error_is_set (&error)) {
+ product_id = libhal_device_get_property_int (hal_ctx, parent_udi, property_name, &error);
+ if (dbus_error_is_set (&error))
+ {
g_warning ("error getting product id: %s: %s", error.name, error.message);
dbus_error_free (&error);
}
@@ -382,7 +386,7 @@ cheese_webcam_get_video_devices_from_hal (CheeseWebcam *webcam)
if (ok < 0)
{
g_warning ("Error while probing v4l capabilities for %s: %s",
- device, strerror (errno));
+ device, strerror (errno));
libhal_free_string (device);
close (fd);
continue;
@@ -397,8 +401,9 @@ cheese_webcam_get_video_devices_from_hal (CheeseWebcam *webcam)
guint cap = v2cap.capabilities;
g_print ("Detected v4l2 device: %s\n", v2cap.card);
g_print ("Driver: %s, version: %d\n", v2cap.driver, v2cap.version);
+
/* g_print ("Bus info: %s\n", v2cap.bus_info); */ /* Doesn't seem anything useful */
- g_print ("Capabilities: 0x%08X\n", v2cap.capabilities);
+ g_print ("Capabilities: 0x%08X\n", v2cap.capabilities);
if (!(cap & V4L2_CAP_VIDEO_CAPTURE))
{
g_print ("Device %s seems to not have the capture capability, (radio tuner?)\n"
@@ -507,36 +512,38 @@ cheese_webcam_get_supported_framerates (CheeseVideoFormat *video_format, GstStru
static void
cheese_webcam_add_video_format (CheeseWebcamDevice *webcam_device,
- CheeseVideoFormat *video_format, GstStructure *format_structure)
+ CheeseVideoFormat *video_format, GstStructure *format_structure)
{
- int i;
+ int i;
gchar *resolution;
cheese_webcam_get_supported_framerates (video_format, format_structure);
find_highest_framerate (video_format);
- g_print ("%s %d x %d num_framerates %d\n", video_format->mimetype, video_format->width,
+ g_print ("%s %d x %d num_framerates %d\n", video_format->mimetype, video_format->width,
video_format->height, video_format->num_framerates);
for (i = 0; i < video_format->num_framerates; i++)
{
g_print ("%d/%d ", video_format->framerates[i].numerator,
video_format->framerates[i].denominator);
}
-
+
resolution = g_strdup_printf ("%ix%i", video_format->width,
video_format->height);
- i = GPOINTER_TO_INT(g_hash_table_lookup (
- webcam_device->supported_resolutions,
- resolution));
- if (i) { /* Resolution already added ? */
- CheeseVideoFormat *curr_format = &g_array_index(
- webcam_device->video_formats,
- CheeseVideoFormat, i - 1);
- float new_framerate = (float)video_format->highest_framerate.numerator /
- video_format->highest_framerate.denominator;
- float curr_framerate = (float)curr_format->highest_framerate.numerator /
- curr_format->highest_framerate.denominator;
- if (new_framerate > curr_framerate) {
+ i = GPOINTER_TO_INT (g_hash_table_lookup (
+ webcam_device->supported_resolutions,
+ resolution));
+ if (i) /* Resolution already added ? */
+ {
+ CheeseVideoFormat *curr_format = &g_array_index (
+ webcam_device->video_formats,
+ CheeseVideoFormat, i - 1);
+ float new_framerate = (float) video_format->highest_framerate.numerator /
+ video_format->highest_framerate.denominator;
+ float curr_framerate = (float) curr_format->highest_framerate.numerator /
+ curr_format->highest_framerate.denominator;
+ if (new_framerate > curr_framerate)
+ {
g_print ("higher framerate replacing existing format\n");
*curr_format = *video_format;
}
@@ -549,12 +556,13 @@ cheese_webcam_add_video_format (CheeseWebcamDevice *webcam_device,
g_array_append_val (webcam_device->video_formats, *video_format);
g_hash_table_insert (webcam_device->supported_resolutions, resolution,
- GINT_TO_POINTER(webcam_device->num_video_formats + 1));
+ GINT_TO_POINTER (webcam_device->num_video_formats + 1));
webcam_device->num_video_formats++;
}
-static gint cheese_resolution_compare(gconstpointer _a, gconstpointer _b)
+static gint
+cheese_resolution_compare (gconstpointer _a, gconstpointer _b)
{
const CheeseVideoFormat *a = _a;
const CheeseVideoFormat *b = _b;
@@ -598,7 +606,7 @@ cheese_webcam_get_supported_video_formats (CheeseWebcamDevice *webcam_device, Gs
video_format.mimetype = g_strdup (gst_structure_get_name (structure));
gst_structure_get_int (structure, "width", &(video_format.width));
gst_structure_get_int (structure, "height", &(video_format.height));
- cheese_webcam_add_video_format(webcam_device, &video_format, structure);
+ cheese_webcam_add_video_format (webcam_device, &video_format, structure);
}
else if (GST_VALUE_HOLDS_INT_RANGE (width))
{
@@ -612,8 +620,9 @@ cheese_webcam_get_supported_video_formats (CheeseWebcamDevice *webcam_device, Gs
cur_width = min_width;
cur_height = min_height;
+
/* Gstreamer will sometimes give us a range with min_xxx == max_xxx,
- we use <= here (and not below) to make this work */
+ * we use <= here (and not below) to make this work */
while (cur_width <= max_width && cur_height <= max_height)
{
CheeseVideoFormat video_format;
@@ -621,7 +630,7 @@ cheese_webcam_get_supported_video_formats (CheeseWebcamDevice *webcam_device, Gs
video_format.mimetype = g_strdup (gst_structure_get_name (structure));
video_format.width = cur_width;
video_format.height = cur_height;
- cheese_webcam_add_video_format(webcam_device, &video_format, structure);
+ cheese_webcam_add_video_format (webcam_device, &video_format, structure);
cur_width *= 2;
cur_height *= 2;
}
@@ -635,7 +644,7 @@ cheese_webcam_get_supported_video_formats (CheeseWebcamDevice *webcam_device, Gs
video_format.mimetype = g_strdup (gst_structure_get_name (structure));
video_format.width = cur_width;
video_format.height = cur_height;
- cheese_webcam_add_video_format(webcam_device, &video_format, structure);
+ cheese_webcam_add_video_format (webcam_device, &video_format, structure);
cur_width /= 2;
cur_height /= 2;
}
@@ -645,19 +654,20 @@ cheese_webcam_get_supported_video_formats (CheeseWebcamDevice *webcam_device, Gs
g_critical ("GValue type %s, cannot be handled for resolution width", G_VALUE_TYPE_NAME (width));
}
}
-
+
/* Sort the format array (so that it will show sorted in the resolution
- selection GUI), and rebuild the hashtable (as that will be invalid after
- the sorting) */
+ * selection GUI), and rebuild the hashtable (as that will be invalid after
+ * the sorting) */
g_array_sort (webcam_device->video_formats, cheese_resolution_compare);
g_hash_table_remove_all (webcam_device->supported_resolutions);
- for (i = 0; i < webcam_device->num_video_formats; i++) {
- CheeseVideoFormat *format = &g_array_index(webcam_device->video_formats,
- CheeseVideoFormat, i);
- g_hash_table_insert (webcam_device->supported_resolutions,
+ for (i = 0; i < webcam_device->num_video_formats; i++)
+ {
+ CheeseVideoFormat *format = &g_array_index (webcam_device->video_formats,
+ CheeseVideoFormat, i);
+ g_hash_table_insert (webcam_device->supported_resolutions,
g_strdup_printf ("%ix%i", format->width,
- format->height),
- GINT_TO_POINTER(i + 1));
+ format->height),
+ GINT_TO_POINTER (i + 1));
}
}
@@ -783,7 +793,7 @@ find_highest_framerate (CheeseVideoFormat *format)
}
}
- format->highest_framerate.numerator = framerate_numerator;
+ format->highest_framerate.numerator = framerate_numerator;
format->highest_framerate.denominator = framerate_denominator;
}
@@ -825,7 +835,7 @@ cheese_webcam_create_webcam_source_bin (CheeseWebcam *webcam)
* camera supports it. */
if (priv->x_resolution != 0 && priv->y_resolution != 0)
{
- i = GPOINTER_TO_INT(g_hash_table_lookup (selected_webcam->supported_resolutions, resolution));
+ i = GPOINTER_TO_INT (g_hash_table_lookup (selected_webcam->supported_resolutions, resolution));
if (i)
format = &g_array_index (selected_webcam->video_formats,
CheeseVideoFormat, i - 1);
@@ -841,8 +851,8 @@ cheese_webcam_create_webcam_source_bin (CheeseWebcam *webcam)
CheeseVideoFormat *new = &g_array_index (selected_webcam->video_formats,
CheeseVideoFormat, i);
gfloat newrate = new->highest_framerate.numerator /
- new->highest_framerate.denominator;
- if ((new->width+new->height) > (format->width+format->height) &&
+ new->highest_framerate.denominator;
+ if ((new->width + new->height) > (format->width + format->height) &&
(newrate >= MIN_DEFAULT_RATE))
{
format = new;
@@ -959,12 +969,12 @@ cheese_webcam_create_video_display_bin (CheeseWebcam *webcam, GError **error)
}
if ((priv->video_balance = gst_element_factory_make ("videobalance", "video_balance")) == NULL)
{
- cheese_webcam_set_error_element_not_found(error, "videobalance");
+ cheese_webcam_set_error_element_not_found (error, "videobalance");
return FALSE;
}
if ((priv->csp_post_balance = gst_element_factory_make ("ffmpegcolorspace", "csp_post_balance")) == NULL)
{
- cheese_webcam_set_error_element_not_found(error, "ffmpegcolorspace");
+ cheese_webcam_set_error_element_not_found (error, "ffmpegcolorspace");
return FALSE;
}
@@ -1008,7 +1018,7 @@ cheese_webcam_create_video_display_bin (CheeseWebcam *webcam, GError **error)
video_display_queue, video_scale, video_sink, NULL);
ok = gst_element_link_many (priv->webcam_source_bin, priv->effect_filter,
- priv->csp_post_effect,
+ priv->csp_post_effect,
priv->video_balance, priv->csp_post_balance,
tee, NULL);
@@ -1135,7 +1145,9 @@ cheese_webcam_create_video_save_bin (CheeseWebcam *webcam, GError **error)
if ((mux = gst_element_factory_make ("oggmux", "mux")) == NULL)
{
cheese_webcam_set_error_element_not_found (error, "oggmux");
- } else {
+ }
+ else
+ {
g_object_set (G_OBJECT (mux),
"max-delay", (guint64) 10000000,
"max-page-delay", (guint64) 10000000, NULL);
@@ -1345,10 +1357,11 @@ cheese_webcam_start_video_recording (CheeseWebcam *webcam, char *filename)
static gboolean
cheese_webcam_force_stop_video_recording (gpointer data)
{
- CheeseWebcam *webcam = CHEESE_WEBCAM (data);
- CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
+ CheeseWebcam *webcam = CHEESE_WEBCAM (data);
+ CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
- if (priv->is_recording) {
+ if (priv->is_recording)
+ {
g_print ("Cannot cleanly shutdown recording pipeline, forcing\n");
g_signal_emit (webcam, webcam_signals[VIDEO_SAVED], 0);
@@ -1364,17 +1377,20 @@ void
cheese_webcam_stop_video_recording (CheeseWebcam *webcam)
{
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
- GstState state;
+ GstState state;
gst_element_get_state (priv->pipeline, &state, NULL, 0);
- if (state == GST_STATE_PLAYING) {
+ if (state == GST_STATE_PLAYING)
+ {
/* Send EOS message down the pipeline by stopping video and audio source*/
g_print ("Sending EOS event down the recording pipeline\n");
gst_element_send_event (priv->video_source, gst_event_new_eos ());
gst_element_send_event (priv->audio_source, gst_event_new_eos ());
priv->eos_timeout_id = g_timeout_add (3000, cheese_webcam_force_stop_video_recording, webcam);
- } else {
+ }
+ else
+ {
cheese_webcam_force_stop_video_recording (webcam);
}
}
@@ -1384,7 +1400,8 @@ cheese_webcam_take_photo (CheeseWebcam *webcam, char *filename)
{
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
- if (priv->photo_handler_signal_id != 0) {
+ if (priv->photo_handler_signal_id != 0)
+ {
g_print ("Still waiting for previous photo data, ignoring new request\n");
return FALSE;
}
@@ -1567,11 +1584,11 @@ cheese_webcam_init (CheeseWebcam *webcam)
{
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
- priv->is_recording = FALSE;
- priv->pipeline_is_playing = FALSE;
- priv->photo_filename = NULL;
- priv->webcam_devices = NULL;
- priv->device_name = NULL;
+ priv->is_recording = FALSE;
+ priv->pipeline_is_playing = FALSE;
+ priv->photo_filename = NULL;
+ priv->webcam_devices = NULL;
+ priv->device_name = NULL;
priv->photo_handler_signal_id = 0;
}
@@ -1746,8 +1763,8 @@ cheese_webcam_get_balance_property_range (CheeseWebcam *webcam,
gdouble *min, gdouble *max, gdouble *def)
{
CheeseWebcamPrivate *priv = CHEESE_WEBCAM_GET_PRIVATE (webcam);
- GParamSpec *pspec;
-
+ GParamSpec *pspec;
+
*min = 0.0;
*max = 0.0;
*def = 0.0;
diff --git a/src/cheese-webcam.h b/src/cheese-webcam.h
index 814bc37..d04052b 100644
--- a/src/cheese-webcam.h
+++ b/src/cheese-webcam.h
@@ -49,7 +49,7 @@ typedef struct
int height;
int num_framerates;
CheeseFramerate *framerates;
- CheeseFramerate highest_framerate;
+ CheeseFramerate highest_framerate;
} CheeseVideoFormat;
typedef struct
@@ -108,7 +108,7 @@ void cheese_webcam_stop (CheeseWebcam *webcam);
void cheese_webcam_set_effect (CheeseWebcam *webcam, CheeseWebcamEffect effect);
void cheese_webcam_start_video_recording (CheeseWebcam *webcam, char *filename);
void cheese_webcam_stop_video_recording (CheeseWebcam *webcam);
-gboolean cheese_webcam_take_photo (CheeseWebcam *webcam, char *filename);
+gboolean cheese_webcam_take_photo (CheeseWebcam *webcam, char *filename);
gboolean cheese_webcam_has_webcam (CheeseWebcam *webcam);
int cheese_webcam_get_num_webcam_devices (CheeseWebcam *webcam);
int cheese_webcam_get_selected_device_index (CheeseWebcam *webcam);
@@ -119,10 +119,10 @@ gboolean cheese_webcam_switch_webcam_device (CheeseWebcam *webcam);
GArray * cheese_webcam_get_video_formats (CheeseWebcam *webcam);
void cheese_webcam_set_video_format (CheeseWebcam *webcam,
CheeseVideoFormat *format);
-void cheese_webcam_get_balance_property_range (CheeseWebcam *webcam,
- gchar *property,
- gdouble *min, gdouble *max, gdouble *def);
-void cheese_webcam_set_balance_property (CheeseWebcam *webcam, gchar *property, gdouble value);
+void cheese_webcam_get_balance_property_range (CheeseWebcam *webcam,
+ gchar *property,
+ gdouble *min, gdouble *max, gdouble *def);
+void cheese_webcam_set_balance_property (CheeseWebcam *webcam, gchar *property, gdouble value);
G_END_DECLS
#endif /* __CHEESE_WEBCAM_H__ */
diff --git a/src/cheese-window.c b/src/cheese-window.c
index 027882f..7607cc5 100644
--- a/src/cheese-window.c
+++ b/src/cheese-window.c
@@ -40,7 +40,7 @@
#include <libebook/e-book.h>
#ifdef HAVE_MMKEYS
-#include <X11/XF86keysym.h>
+ #include <X11/XF86keysym.h>
#endif /* HAVE_MMKEYS */
#ifdef HILDON
@@ -65,8 +65,8 @@
#define FULLSCREEN_POPUP_HEIGHT 40
#define FULLSCREEN_TIMEOUT 5 * 1000
#define FULLSCREEN_EFFECTS_TIMEOUT 15
-#define DEFAULT_WINDOW_WIDTH 600
-#define DEFAULT_WINDOW_HEIGHT 450
+#define DEFAULT_WINDOW_WIDTH 600
+#define DEFAULT_WINDOW_HEIGHT 450
typedef enum
{
@@ -277,17 +277,19 @@ cheese_window_key_press_event_cb (GtkWidget *win, GdkEventKey *event, CheeseWind
* let Gtk+ handle the key */
if (event->state != 0
&& ((event->state & GDK_CONTROL_MASK)
- || (event->state & GDK_MOD1_MASK)
- || (event->state & GDK_MOD3_MASK)
- || (event->state & GDK_MOD4_MASK)
- || (event->state & GDK_MOD5_MASK)))
+ || (event->state & GDK_MOD1_MASK)
+ || (event->state & GDK_MOD3_MASK)
+ || (event->state & GDK_MOD4_MASK)
+ || (event->state & GDK_MOD5_MASK)))
return FALSE;
- switch (event->keyval) {
- case XF86XK_WebCam:
- /* do stuff */
- cheese_window_action_button_clicked_cb (NULL, cheese_window);
- return TRUE;
+ switch (event->keyval)
+ {
+ case XF86XK_WebCam:
+
+ /* do stuff */
+ cheese_window_action_button_clicked_cb (NULL, cheese_window);
+ return TRUE;
}
return FALSE;
@@ -324,7 +326,7 @@ cheese_window_fullscreen_set_timeout (CheeseWindow *cheese_window)
GSource *source;
cheese_window_fullscreen_clear_timeout (cheese_window);
-
+
source = g_timeout_source_new (FULLSCREEN_TIMEOUT);
g_source_set_callback (source, cheese_window_fullscreen_timeout_cb, cheese_window, NULL);
@@ -358,8 +360,8 @@ cheese_window_fullscreen_motion_notify_cb (GtkWidget *widget,
{
cheese_window_fullscreen_show_bar (cheese_window);
}
-
- //don't set the timeout in effect-chooser mode
+
+ /* don't set the timeout in effect-chooser mode */
if (gtk_notebook_get_current_page (GTK_NOTEBOOK (cheese_window->notebook)) != 1)
cheese_window_fullscreen_set_timeout (cheese_window);
}
@@ -393,11 +395,11 @@ cheese_window_toggle_fullscreen (GtkWidget *widget, CheeseWindow *cheese_window)
cheese_window);
gtk_window_fullscreen (GTK_WINDOW (cheese_window->window));
-
+
gtk_widget_set_size_request (cheese_window->effect_alignment, -1, FULLSCREEN_POPUP_HEIGHT);
cheese_window_fullscreen_show_bar (cheese_window);
-
- //don't set the timeout in effect-chooser mode
+
+ /* don't set the timeout in effect-chooser mode */
if (gtk_notebook_get_current_page (GTK_NOTEBOOK (cheese_window->notebook)) != 1)
cheese_window_fullscreen_set_timeout (cheese_window);
@@ -408,7 +410,7 @@ cheese_window_toggle_fullscreen (GtkWidget *widget, CheeseWindow *cheese_window)
gtk_widget_show_all (cheese_window->window);
gtk_widget_hide_all (cheese_window->fullscreen_popup);
gtk_widget_modify_bg (cheese_window->window, GTK_STATE_NORMAL, NULL);
-
+
g_signal_handlers_disconnect_by_func (cheese_window->window,
(gpointer) cheese_window_fullscreen_motion_notify_cb, cheese_window);
g_signal_handlers_disconnect_by_func (cheese_window->screen,
@@ -449,11 +451,11 @@ cheese_window_photo_saved_cb (CheeseWebcam *webcam, CheeseWindow *cheese_window)
gdk_threads_leave ();
}
-
static void
cheese_window_video_saved_cb (CheeseWebcam *webcam, CheeseWindow *cheese_window)
{
gdk_threads_enter ();
+
/* TODO look at this g_free */
g_free (cheese_window->video_filename);
cheese_window->video_filename = NULL;
@@ -976,7 +978,7 @@ cheese_window_cmd_command_line (GtkAction *action, CheeseWindow *cheese_window)
static void
cheese_window_cmd_help_contents (GtkAction *action, CheeseWindow *cheese_window)
{
- GError *error = NULL;
+ GError *error = NULL;
GdkScreen *screen;
screen = gtk_widget_get_screen (GTK_WIDGET (cheese_window));
@@ -1236,7 +1238,7 @@ cheese_window_countdown_picture_cb (gpointer data)
{
cheese_flash_fire (cheese_window->flash);
shutter_filename = audio_play_get_filename (cheese_window);
- audio_play = gst_audio_play_file (shutter_filename, &error);
+ audio_play = gst_audio_play_file (shutter_filename, &error);
if (!audio_play)
{
g_warning ("%s", error ? error->message : "Unknown error");
@@ -1697,6 +1699,7 @@ cheese_window_create_window (CheeseWindow *cheese_window)
cheese_window->thumb_view = cheese_thumb_view_new ();
cheese_window->thumb_nav = eog_thumb_nav_new (cheese_window->thumb_view, TRUE);
gtk_container_add (GTK_CONTAINER (cheese_window->thumb_scrollwindow), cheese_window->thumb_nav);
+
/* show the scroll window to get it included in the size requisition done later */
gtk_widget_show_all (cheese_window->thumb_scrollwindow);
@@ -1886,7 +1889,7 @@ cheese_window_create_window (CheeseWindow *cheese_window)
/* Listen for key presses */
gtk_widget_add_events (cheese_window->window, GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK);
g_signal_connect (cheese_window->window, "key_press_event",
- G_CALLBACK (cheese_window_key_press_event_cb), cheese_window);
+ G_CALLBACK (cheese_window_key_press_event_cb), cheese_window);
g_signal_connect (cheese_window->take_picture, "clicked",
G_CALLBACK (cheese_window_action_button_clicked_cb), cheese_window);
diff --git a/src/cheese.c b/src/cheese.c
index c8c5156..04879b5 100644
--- a/src/cheese.c
+++ b/src/cheese.c
@@ -154,7 +154,7 @@ main (int argc, char **argv)
{
GOptionContext *context;
CheeseDbus *dbus_server;
- GError *error = NULL;
+ GError *error = NULL;
GOptionEntry options[] = {
{"verbose", 'v', 0, G_OPTION_ARG_NONE, &CheeseOptions.verbose, _("Be verbose"), NULL},
@@ -179,7 +179,8 @@ main (int argc, char **argv)
g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE);
g_option_context_add_group (context, gtk_get_option_group (TRUE));
g_option_context_add_group (context, gst_init_get_option_group ());
- if (g_option_context_parse (context, &argc, &argv, &error) == FALSE) {
+ if (g_option_context_parse (context, &argc, &argv, &error) == FALSE)
+ {
gchar *help_text = g_option_context_get_help (context, TRUE, NULL);
g_print ("%s\n\n%s", error->message, help_text);
g_free (help_text);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]