diff options
author | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-15 19:32:27 +0000 |
---|---|---|
committer | Thomas Vander Stichele <thomas@apestaart.org> | 2004-03-15 19:32:27 +0000 |
commit | 4fd57bbe3fef59592a8664dcc9fa2ab32ae99c69 (patch) | |
tree | 8f41b30e571aa6ed88b53f5471d5e38461136e60 /sys/v4l2 | |
parent | 9f4226fe55f09cf5809376b467aa3f46dbf7b5c2 (diff) | |
download | gst-plugins-bad-4fd57bbe3fef59592a8664dcc9fa2ab32ae99c69.tar.gz gst-plugins-bad-4fd57bbe3fef59592a8664dcc9fa2ab32ae99c69.tar.bz2 gst-plugins-bad-4fd57bbe3fef59592a8664dcc9fa2ab32ae99c69.zip |
don't mix tabs and spaces
Original commit message from CVS:
don't mix tabs and spaces
Diffstat (limited to 'sys/v4l2')
-rw-r--r-- | sys/v4l2/gstv4l2.c | 4 | ||||
-rw-r--r-- | sys/v4l2/gstv4l2colorbalance.c | 8 | ||||
-rw-r--r-- | sys/v4l2/gstv4l2element.c | 132 | ||||
-rw-r--r-- | sys/v4l2/gstv4l2src.c | 557 | ||||
-rw-r--r-- | sys/v4l2/gstv4l2tuner.c | 18 | ||||
-rw-r--r-- | sys/v4l2/gstv4l2xoverlay.c | 4 | ||||
-rw-r--r-- | sys/v4l2/v4l2-overlay_calls.c | 10 | ||||
-rw-r--r-- | sys/v4l2/v4l2_calls.c | 232 | ||||
-rw-r--r-- | sys/v4l2/v4l2src_calls.c | 82 |
9 files changed, 524 insertions, 523 deletions
diff --git a/sys/v4l2/gstv4l2.c b/sys/v4l2/gstv4l2.c index 633ce52e..194cb077 100644 --- a/sys/v4l2/gstv4l2.c +++ b/sys/v4l2/gstv4l2.c @@ -37,9 +37,9 @@ plugin_init (GstPlugin * plugin) return FALSE; if (!gst_element_register (plugin, "v4l2element", - GST_RANK_NONE, GST_TYPE_V4L2ELEMENT) || + GST_RANK_NONE, GST_TYPE_V4L2ELEMENT) || !gst_element_register (plugin, "v4l2src", - GST_RANK_NONE, GST_TYPE_V4L2SRC)) + GST_RANK_NONE, GST_TYPE_V4L2SRC)) return FALSE; #ifdef ENABLE_NLS diff --git a/sys/v4l2/gstv4l2colorbalance.c b/sys/v4l2/gstv4l2colorbalance.c index 274043d8..db53d7f9 100644 --- a/sys/v4l2/gstv4l2colorbalance.c +++ b/sys/v4l2/gstv4l2colorbalance.c @@ -62,8 +62,8 @@ gst_v4l2_color_balance_channel_get_type (void) }; gst_v4l2_color_balance_channel_type = - g_type_register_static (GST_TYPE_COLOR_BALANCE_CHANNEL, - "GstV4l2ColorBalanceChannel", &v4l2_tuner_channel_info, 0); + g_type_register_static (GST_TYPE_COLOR_BALANCE_CHANNEL, + "GstV4l2ColorBalanceChannel", &v4l2_tuner_channel_info, 0); } return gst_v4l2_color_balance_channel_type; @@ -123,7 +123,7 @@ gst_v4l2_color_balance_set_value (GstColorBalance * balance, /* assert that we're opened and that we're using a known item */ g_return_if_fail (GST_V4L2_IS_OPEN (v4l2element)); g_return_if_fail (gst_v4l2_color_balance_contains_channel (v4l2element, - v4l2channel)); + v4l2channel)); gst_v4l2_set_attribute (v4l2element, v4l2channel->index, value); } @@ -140,7 +140,7 @@ gst_v4l2_color_balance_get_value (GstColorBalance * balance, /* assert that we're opened and that we're using a known item */ g_return_val_if_fail (GST_V4L2_IS_OPEN (v4l2element), 0); g_return_val_if_fail (gst_v4l2_color_balance_contains_channel (v4l2element, - v4l2channel), 0); + v4l2channel), 0); if (!gst_v4l2_get_attribute (v4l2element, v4l2channel->index, &value)) return 0; diff --git a/sys/v4l2/gstv4l2element.c b/sys/v4l2/gstv4l2element.c index 246d4949..1595e87f 100644 --- a/sys/v4l2/gstv4l2element.c +++ b/sys/v4l2/gstv4l2element.c @@ -138,22 +138,22 @@ gst_v4l2_class_probe_devices (GstV4l2ElementClass * klass, gboolean check) /* detect /dev entries */ for (n = 0; n < 64; n++) { for (base = 0; dev_base[base] != NULL; base++) { - struct stat s; - gchar *device = g_strdup_printf ("%s%d", - dev_base[base], n); - - /* does the /dev/ entry exist at all? */ - if (stat (device, &s) == 0) { - /* yes: is a device attached? */ - if ((fd = open (device, O_RDONLY)) > 0 || errno == EBUSY) { - if (fd > 0) - close (fd); - - devices = g_list_append (devices, device); - break; - } - } - g_free (device); + struct stat s; + gchar *device = g_strdup_printf ("%s%d", + dev_base[base], n); + + /* does the /dev/ entry exist at all? */ + if (stat (device, &s) == 0) { + /* yes: is a device attached? */ + if ((fd = open (device, O_RDONLY)) > 0 || errno == EBUSY) { + if (fd > 0) + close (fd); + + devices = g_list_append (devices, device); + break; + } + } + g_free (device); } } @@ -301,19 +301,19 @@ gst_v4l2element_get_type (void) }; v4l2element_type = - g_type_register_static (GST_TYPE_ELEMENT, - "GstV4l2Element", &v4l2element_info, 0); + g_type_register_static (GST_TYPE_ELEMENT, + "GstV4l2Element", &v4l2element_info, 0); g_type_add_interface_static (v4l2element_type, - GST_TYPE_IMPLEMENTS_INTERFACE, &v4l2iface_info); + GST_TYPE_IMPLEMENTS_INTERFACE, &v4l2iface_info); g_type_add_interface_static (v4l2element_type, - GST_TYPE_TUNER, &v4l2_tuner_info); + GST_TYPE_TUNER, &v4l2_tuner_info); g_type_add_interface_static (v4l2element_type, - GST_TYPE_X_OVERLAY, &v4l2_xoverlay_info); + GST_TYPE_X_OVERLAY, &v4l2_xoverlay_info); g_type_add_interface_static (v4l2element_type, - GST_TYPE_COLOR_BALANCE, &v4l2_colorbalance_info); + GST_TYPE_COLOR_BALANCE, &v4l2_colorbalance_info); g_type_add_interface_static (v4l2element_type, - GST_TYPE_PROPERTY_PROBE, &v4l2_propertyprobe_info); + GST_TYPE_PROPERTY_PROBE, &v4l2_propertyprobe_info); } return v4l2element_type; @@ -329,20 +329,20 @@ gst_v4l2_device_get_type (void) if (v4l2_device_type == 0) { static const GFlagsValue values[] = { {V4L2_CAP_VIDEO_CAPTURE, "CAPTURE", - "Device can capture"}, + "Device can capture"}, {V4L2_CAP_VIDEO_OUTPUT, "PLAYBACK", - "Device can playback"}, + "Device can playback"}, {V4L2_CAP_VIDEO_OVERLAY, "OVERLAY", - "Device can do overlay"}, + "Device can do overlay"}, {V4L2_CAP_TUNER, "TUNER", - "Device has a tuner"}, + "Device has a tuner"}, {V4L2_CAP_AUDIO, "AUDIO", - "Device handles audio"}, + "Device handles audio"}, {0, NULL, NULL} }; v4l2_device_type = - g_flags_register_static ("GstV4l2DeviceTypeFlags", values); + g_flags_register_static ("GstV4l2DeviceTypeFlags", values); } return v4l2_device_type; @@ -368,22 +368,22 @@ gst_v4l2element_class_init (GstV4l2ElementClass * klass) g_object_class_install_property (gobject_class, ARG_DEVICE, g_param_spec_string ("device", "Device", "Device location", - NULL, G_PARAM_READWRITE)); + NULL, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_DEVICE_NAME, g_param_spec_string ("device_name", "Device name", - "Name of the device", NULL, G_PARAM_READABLE)); + "Name of the device", NULL, G_PARAM_READABLE)); g_object_class_install_property (gobject_class, ARG_FLAGS, g_param_spec_flags ("flags", "Flags", "Device type flags", - GST_TYPE_V4L2_DEVICE_FLAGS, 0, G_PARAM_READABLE)); + GST_TYPE_V4L2_DEVICE_FLAGS, 0, G_PARAM_READABLE)); g_object_class_install_property (gobject_class, ARG_NORM, g_param_spec_string ("norm", "norm", - "Norm to use", NULL, G_PARAM_READWRITE)); + "Norm to use", NULL, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_CHANNEL, g_param_spec_string ("channel", "channel", - "input/output to switch to", NULL, G_PARAM_READWRITE)); + "input/output to switch to", NULL, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_FREQUENCY, g_param_spec_ulong ("frequency", "frequency", - "frequency to tune to", 0, G_MAXULONG, 0, G_PARAM_READWRITE)); + "frequency to tune to", 0, G_MAXULONG, 0, G_PARAM_READWRITE)); /* signals */ gst_v4l2element_signals[SIGNAL_OPEN] = @@ -462,49 +462,49 @@ gst_v4l2element_set_property (GObject * object, switch (prop_id) { case ARG_DEVICE: if (!GST_V4L2_IS_OPEN (v4l2element)) { - if (v4l2element->device) - g_free (v4l2element->device); - v4l2element->device = g_value_dup_string (value); + if (v4l2element->device) + g_free (v4l2element->device); + v4l2element->device = g_value_dup_string (value); } break; case ARG_NORM: if (GST_V4L2_IS_OPEN (v4l2element)) { - GstTunerNorm *norm = gst_tuner_get_norm (tuner); + GstTunerNorm *norm = gst_tuner_get_norm (tuner); - if (norm) { - gst_tuner_set_norm (tuner, norm); - } + if (norm) { + gst_tuner_set_norm (tuner, norm); + } } else { - g_free (v4l2element->norm); - v4l2element->norm = g_value_dup_string (value); - g_object_notify (object, "norm"); + g_free (v4l2element->norm); + v4l2element->norm = g_value_dup_string (value); + g_object_notify (object, "norm"); } break; case ARG_CHANNEL: if (GST_V4L2_IS_OPEN (v4l2element)) { - GstTunerChannel *channel = gst_tuner_get_channel (tuner); + GstTunerChannel *channel = gst_tuner_get_channel (tuner); - if (channel) { - gst_tuner_set_channel (tuner, channel); - } + if (channel) { + gst_tuner_set_channel (tuner, channel); + } } else { - g_free (v4l2element->channel); - v4l2element->channel = g_value_dup_string (value); - g_object_notify (object, "channel"); + g_free (v4l2element->channel); + v4l2element->channel = g_value_dup_string (value); + g_object_notify (object, "channel"); } break; case ARG_FREQUENCY: if (GST_V4L2_IS_OPEN (v4l2element)) { - GstTunerChannel *channel; + GstTunerChannel *channel; - if (!v4l2element->channel) - return; - channel = gst_tuner_get_channel (tuner); - g_assert (channel); - gst_tuner_set_frequency (tuner, channel, g_value_get_ulong (value)); + if (!v4l2element->channel) + return; + channel = gst_tuner_get_channel (tuner); + g_assert (channel); + gst_tuner_set_frequency (tuner, channel, g_value_get_ulong (value)); } else { - v4l2element->frequency = g_value_get_ulong (value); - g_object_notify (object, "frequency"); + v4l2element->frequency = g_value_get_ulong (value); + g_object_notify (object, "frequency"); } break; default: @@ -532,7 +532,7 @@ gst_v4l2element_get_property (GObject * object, gchar *new = NULL; if (GST_V4L2_IS_OPEN (v4l2element)) - new = v4l2element->vcap.card; + new = v4l2element->vcap.card; g_value_set_string (value, new); break; } @@ -540,7 +540,7 @@ gst_v4l2element_get_property (GObject * object, guint flags = 0; if (GST_V4L2_IS_OPEN (v4l2element)) { - flags |= v4l2element->vcap.capabilities & 30007; + flags |= v4l2element->vcap.capabilities & 30007; } g_value_set_flags (value, flags); break; @@ -578,23 +578,23 @@ gst_v4l2element_change_state (GstElement * element) gst_v4l2_set_display (v4l2element); if (!gst_v4l2_open (v4l2element)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; gst_v4l2_xoverlay_open (v4l2element); /* emit a signal! whoopie! */ g_signal_emit (G_OBJECT (v4l2element), - gst_v4l2element_signals[SIGNAL_OPEN], 0, v4l2element->device); + gst_v4l2element_signals[SIGNAL_OPEN], 0, v4l2element->device); break; case GST_STATE_READY_TO_NULL: gst_v4l2_xoverlay_close (v4l2element); if (!gst_v4l2_close (v4l2element)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; /* emit yet another signal! wheehee! */ g_signal_emit (G_OBJECT (v4l2element), - gst_v4l2element_signals[SIGNAL_CLOSE], 0, v4l2element->device); + gst_v4l2element_signals[SIGNAL_CLOSE], 0, v4l2element->device); break; } diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index 5e5cdddc..bc9c66a2 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -58,34 +58,34 @@ enum guint32 gst_v4l2_formats[] = { /* from Linux 2.6.0 videodev2.h */ - V4L2_PIX_FMT_RGB332, /* 8 RGB-3-3-2 */ - V4L2_PIX_FMT_RGB555, /* 16 RGB-5-5-5 */ - V4L2_PIX_FMT_RGB565, /* 16 RGB-5-6-5 */ - V4L2_PIX_FMT_RGB555X, /* 16 RGB-5-5-5 BE */ - V4L2_PIX_FMT_RGB565X, /* 16 RGB-5-6-5 BE */ - V4L2_PIX_FMT_BGR24, /* 24 BGR-8-8-8 */ - V4L2_PIX_FMT_RGB24, /* 24 RGB-8-8-8 */ - V4L2_PIX_FMT_BGR32, /* 32 BGR-8-8-8-8 */ - V4L2_PIX_FMT_RGB32, /* 32 RGB-8-8-8-8 */ - V4L2_PIX_FMT_GREY, /* 8 Greyscale */ - V4L2_PIX_FMT_YVU410, /* 9 YVU 4:1:0 */ - V4L2_PIX_FMT_YVU420, /* 12 YVU 4:2:0 */ - V4L2_PIX_FMT_YUYV, /* 16 YUV 4:2:2 */ - V4L2_PIX_FMT_UYVY, /* 16 YUV 4:2:2 */ - V4L2_PIX_FMT_YUV422P, /* 16 YVU422 planar */ - V4L2_PIX_FMT_YUV411P, /* 16 YVU411 planar */ - V4L2_PIX_FMT_Y41P, /* 12 YUV 4:1:1 */ - V4L2_PIX_FMT_NV12, /* 12 Y/CbCr 4:2:0 */ - V4L2_PIX_FMT_NV21, /* 12 Y/CrCb 4:2:0 */ - V4L2_PIX_FMT_YUV410, /* 9 YUV 4:1:0 */ - V4L2_PIX_FMT_YUV420, /* 12 YUV 4:2:0 */ - V4L2_PIX_FMT_YYUV, /* 16 YUV 4:2:2 */ - V4L2_PIX_FMT_HI240, /* 8 8-bit color */ - V4L2_PIX_FMT_MJPEG, /* Motion-JPEG */ - V4L2_PIX_FMT_JPEG, /* JFIF JPEG */ - V4L2_PIX_FMT_DV, /* 1394 */ - V4L2_PIX_FMT_MPEG, /* MPEG */ - V4L2_PIX_FMT_WNVA /* Winnov hw compres */ + V4L2_PIX_FMT_RGB332, /* 8 RGB-3-3-2 */ + V4L2_PIX_FMT_RGB555, /* 16 RGB-5-5-5 */ + V4L2_PIX_FMT_RGB565, /* 16 RGB-5-6-5 */ + V4L2_PIX_FMT_RGB555X, /* 16 RGB-5-5-5 BE */ + V4L2_PIX_FMT_RGB565X, /* 16 RGB-5-6-5 BE */ + V4L2_PIX_FMT_BGR24, /* 24 BGR-8-8-8 */ + V4L2_PIX_FMT_RGB24, /* 24 RGB-8-8-8 */ + V4L2_PIX_FMT_BGR32, /* 32 BGR-8-8-8-8 */ + V4L2_PIX_FMT_RGB32, /* 32 RGB-8-8-8-8 */ + V4L2_PIX_FMT_GREY, /* 8 Greyscale */ + V4L2_PIX_FMT_YVU410, /* 9 YVU 4:1:0 */ + V4L2_PIX_FMT_YVU420, /* 12 YVU 4:2:0 */ + V4L2_PIX_FMT_YUYV, /* 16 YUV 4:2:2 */ + V4L2_PIX_FMT_UYVY, /* 16 YUV 4:2:2 */ + V4L2_PIX_FMT_YUV422P, /* 16 YVU422 planar */ + V4L2_PIX_FMT_YUV411P, /* 16 YVU411 planar */ + V4L2_PIX_FMT_Y41P, /* 12 YUV 4:1:1 */ + V4L2_PIX_FMT_NV12, /* 12 Y/CbCr 4:2:0 */ + V4L2_PIX_FMT_NV21, /* 12 Y/CrCb 4:2:0 */ + V4L2_PIX_FMT_YUV410, /* 9 YUV 4:1:0 */ + V4L2_PIX_FMT_YUV420, /* 12 YUV 4:2:0 */ + V4L2_PIX_FMT_YYUV, /* 16 YUV 4:2:2 */ + V4L2_PIX_FMT_HI240, /* 8 8-bit color */ + V4L2_PIX_FMT_MJPEG, /* Motion-JPEG */ + V4L2_PIX_FMT_JPEG, /* JFIF JPEG */ + V4L2_PIX_FMT_DV, /* 1394 */ + V4L2_PIX_FMT_MPEG, /* MPEG */ + V4L2_PIX_FMT_WNVA /* Winnov hw compres */ }; #define GST_V4L2_FORMAT_COUNT (G_N_ELEMENTS (gst_v4l2_formats)) @@ -150,8 +150,9 @@ gst_v4l2src_get_type (void) gst_v4l2src_init, NULL }; + v4l2src_type = g_type_register_static (GST_TYPE_V4L2ELEMENT, - "GstV4l2Src", &v4l2src_info, 0); + "GstV4l2Src", &v4l2src_info, 0); GST_DEBUG_CATEGORY_INIT (v4l2src_debug, "v4l2src", 0, "v4l2src element"); } return v4l2src_type; @@ -185,16 +186,16 @@ gst_v4l2src_class_init (gpointer g_class, gpointer class_data) g_object_class_install_property (gobject_class, ARG_NUMBUFS, g_param_spec_int ("num_buffers", "num_buffers", "num_buffers", - G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); + G_MININT, G_MAXINT, 0, G_PARAM_READWRITE)); g_object_class_install_property (gobject_class, ARG_BUFSIZE, g_param_spec_int ("buffer_size", "buffer_size", "buffer_size", - G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); + G_MININT, G_MAXINT, 0, G_PARAM_READABLE)); g_object_class_install_property (gobject_class, ARG_USE_FIXED_FPS, g_param_spec_boolean ("use_fixed_fps", "Use Fixed FPS", - "Drop/Insert frames to reach a certain FPS (TRUE) " - "or adapt FPS to suit the number of frabbed frames", - TRUE, G_PARAM_READWRITE)); + "Drop/Insert frames to reach a certain FPS (TRUE) " + "or adapt FPS to suit the number of frabbed frames", + TRUE, G_PARAM_READWRITE)); /* signals */ gst_v4l2src_signals[SIGNAL_FRAME_CAPTURE] = @@ -280,7 +281,7 @@ gst_v4l2src_get_fps (GstV4l2Src * v4l2src) if (!v4l2src->use_fixed_fps && v4l2src->clock != NULL && v4l2src->handled > 0) { /* try to get time from clock master and calculate fps */ GstClockTime time = gst_clock_get_time (v4l2src->clock) - - v4l2src->substract_time; + v4l2src->substract_time; return v4l2src->handled * GST_SECOND / time; } @@ -317,21 +318,21 @@ gst_v4l2src_src_convert (GstPad * pad, switch (src_format) { case GST_FORMAT_TIME: switch (*dest_format) { - case GST_FORMAT_DEFAULT: - *dest_value = src_value * fps / GST_SECOND; - break; - default: - return FALSE; + case GST_FORMAT_DEFAULT: + *dest_value = src_value * fps / GST_SECOND; + break; + default: + return FALSE; } break; case GST_FORMAT_DEFAULT: switch (*dest_format) { - case GST_FORMAT_TIME: - *dest_value = src_value * GST_SECOND / fps; - break; - default: - return FALSE; + case GST_FORMAT_TIME: + *dest_value = src_value * GST_SECOND / fps; + break; + default: + return FALSE; } break; @@ -356,15 +357,15 @@ gst_v4l2src_src_query (GstPad * pad, switch (type) { case GST_QUERY_POSITION: switch (*format) { - case GST_FORMAT_TIME: - *value = v4l2src->handled * GST_SECOND / fps; - break; - case GST_FORMAT_DEFAULT: - *value = v4l2src->handled; - break; - default: - res = FALSE; - break; + case GST_FORMAT_TIME: + *value = v4l2src->handled * GST_SECOND / fps; + break; + case GST_FORMAT_DEFAULT: + *value = v4l2src->handled; + break; + default: + res = FALSE; + break; } break; default: @@ -381,8 +382,8 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc) GstStructure *structure = NULL; switch (fourcc) { - case V4L2_PIX_FMT_MJPEG: /* Motion-JPEG */ - case V4L2_PIX_FMT_JPEG: /* JFIF JPEG */ + case V4L2_PIX_FMT_MJPEG: /* Motion-JPEG */ + case V4L2_PIX_FMT_JPEG: /* JFIF JPEG */ structure = gst_structure_new ("video/x-jpeg", NULL); break; case V4L2_PIX_FMT_RGB332: @@ -399,84 +400,84 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc) guint32 r_mask = 0, b_mask = 0, g_mask = 0; switch (fourcc) { - case V4L2_PIX_FMT_RGB332: - bpp = depth = 8; - endianness = G_BYTE_ORDER; /* 'like, whatever' */ - r_mask = 0xe0; - g_mask = 0x1c; - b_mask = 0x03; - break; - case V4L2_PIX_FMT_RGB555: - case V4L2_PIX_FMT_RGB555X: - bpp = 16; - depth = 15; - endianness = - fourcc == V4L2_PIX_FMT_RGB555X ? G_BIG_ENDIAN : G_LITTLE_ENDIAN; - r_mask = 0x7c00; - g_mask = 0x03e0; - b_mask = 0x001f; - break; - case V4L2_PIX_FMT_RGB565: - case V4L2_PIX_FMT_RGB565X: - bpp = depth = 16; - endianness = - fourcc == V4L2_PIX_FMT_RGB565X ? G_BIG_ENDIAN : G_LITTLE_ENDIAN; - r_mask = 0xf800; - g_mask = 0x07e0; - b_mask = 0x001f; - case V4L2_PIX_FMT_RGB24: - bpp = depth = 24; - endianness = G_BIG_ENDIAN; - r_mask = 0xff0000; - g_mask = 0x00ff00; - b_mask = 0x0000ff; - break; - case V4L2_PIX_FMT_BGR24: - bpp = depth = 24; - endianness = G_BIG_ENDIAN; - r_mask = 0x0000ff; - g_mask = 0x00ff00; - b_mask = 0xff0000; - break; - case V4L2_PIX_FMT_RGB32: - bpp = depth = 32; - endianness = G_BIG_ENDIAN; - r_mask = 0xff000000; - g_mask = 0x00ff0000; - b_mask = 0x0000ff00; - break; - case V4L2_PIX_FMT_BGR32: - bpp = depth = 32; - endianness = G_BIG_ENDIAN; - r_mask = 0x000000ff; - g_mask = 0x0000ff00; - b_mask = 0x00ff0000; - break; - default: - g_assert_not_reached (); - break; + case V4L2_PIX_FMT_RGB332: + bpp = depth = 8; + endianness = G_BYTE_ORDER; /* 'like, whatever' */ + r_mask = 0xe0; + g_mask = 0x1c; + b_mask = 0x03; + break; + case V4L2_PIX_FMT_RGB555: + case V4L2_PIX_FMT_RGB555X: + bpp = 16; + depth = 15; + endianness = + fourcc == V4L2_PIX_FMT_RGB555X ? G_BIG_ENDIAN : G_LITTLE_ENDIAN; + r_mask = 0x7c00; + g_mask = 0x03e0; + b_mask = 0x001f; + break; + case V4L2_PIX_FMT_RGB565: + case V4L2_PIX_FMT_RGB565X: + bpp = depth = 16; + endianness = + fourcc == V4L2_PIX_FMT_RGB565X ? G_BIG_ENDIAN : G_LITTLE_ENDIAN; + r_mask = 0xf800; + g_mask = 0x07e0; + b_mask = 0x001f; + case V4L2_PIX_FMT_RGB24: + bpp = depth = 24; + endianness = G_BIG_ENDIAN; + r_mask = 0xff0000; + g_mask = 0x00ff00; + b_mask = 0x0000ff; + break; + case V4L2_PIX_FMT_BGR24: + bpp = depth = 24; + endianness = G_BIG_ENDIAN; + r_mask = 0x0000ff; + g_mask = 0x00ff00; + b_mask = 0xff0000; + break; + case V4L2_PIX_FMT_RGB32: + bpp = depth = 32; + endianness = G_BIG_ENDIAN; + r_mask = 0xff000000; + g_mask = 0x00ff0000; + b_mask = 0x0000ff00; + break; + case V4L2_PIX_FMT_BGR32: + bpp = depth = 32; + endianness = G_BIG_ENDIAN; + r_mask = 0x000000ff; + g_mask = 0x0000ff00; + b_mask = 0x00ff0000; + break; + default: + g_assert_not_reached (); + break; } structure = gst_structure_new ("video/x-raw-rgb", - "bpp", G_TYPE_INT, bpp, - "depth", G_TYPE_INT, depth, - "red_mask", G_TYPE_INT, r_mask, - "green_mask", G_TYPE_INT, g_mask, - "blue_mask", G_TYPE_INT, b_mask, - "endianness", G_TYPE_INT, endianness, NULL); + "bpp", G_TYPE_INT, bpp, + "depth", G_TYPE_INT, depth, + "red_mask", G_TYPE_INT, r_mask, + "green_mask", G_TYPE_INT, g_mask, + "blue_mask", G_TYPE_INT, b_mask, + "endianness", G_TYPE_INT, endianness, NULL); break; } - case V4L2_PIX_FMT_GREY: /* 8 Greyscale */ - case V4L2_PIX_FMT_YUV422P: /* 16 YVU422 planar */ - case V4L2_PIX_FMT_YUV411P: /* 16 YVU411 planar */ - case V4L2_PIX_FMT_NV12: /* 12 Y/CbCr 4:2:0 */ - case V4L2_PIX_FMT_NV21: /* 12 Y/CrCb 4:2:0 */ - case V4L2_PIX_FMT_YYUV: /* 16 YUV 4:2:2 */ - case V4L2_PIX_FMT_HI240: /* 8 8-bit color */ + case V4L2_PIX_FMT_GREY: /* 8 Greyscale */ + case V4L2_PIX_FMT_YUV422P: /* 16 YVU422 planar */ + case V4L2_PIX_FMT_YUV411P: /* 16 YVU411 planar */ + case V4L2_PIX_FMT_NV12: /* 12 Y/CbCr 4:2:0 */ + case V4L2_PIX_FMT_NV21: /* 12 Y/CrCb 4:2:0 */ + case V4L2_PIX_FMT_YYUV: /* 16 YUV 4:2:2 */ + case V4L2_PIX_FMT_HI240: /* 8 8-bit color */ /* FIXME: get correct fourccs here */ break; case V4L2_PIX_FMT_YVU410: case V4L2_PIX_FMT_YUV410: - case V4L2_PIX_FMT_YUV420: /* I420/IYUV */ + case V4L2_PIX_FMT_YUV420: /* I420/IYUV */ case V4L2_PIX_FMT_YUYV: case V4L2_PIX_FMT_YVU420: case V4L2_PIX_FMT_UYVY: @@ -484,48 +485,48 @@ gst_v4l2src_v4l2fourcc_to_caps (guint32 fourcc) guint32 fcc = 0; switch (fourcc) { - case V4L2_PIX_FMT_YVU410: - fcc = GST_MAKE_FOURCC ('Y', 'V', 'U', '9'); - break; - case V4L2_PIX_FMT_YUV410: - fcc = GST_MAKE_FOURCC ('Y', 'U', 'V', '9'); - break; - case V4L2_PIX_FMT_YUV420: - fcc = GST_MAKE_FOURCC ('I', '4', '2', '0'); - break; - case V4L2_PIX_FMT_YUYV: - fcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'); - break; - case V4L2_PIX_FMT_YVU420: - fcc = GST_MAKE_FOURCC ('Y', 'V', '1', '2'); - break; - case V4L2_PIX_FMT_UYVY: - fcc = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'); - break; - case V4L2_PIX_FMT_Y41P: - fcc = GST_MAKE_FOURCC ('Y', '4', '1', 'B'); - break; - default: - g_assert_not_reached (); - break; + case V4L2_PIX_FMT_YVU410: + fcc = GST_MAKE_FOURCC ('Y', 'V', 'U', '9'); + break; + case V4L2_PIX_FMT_YUV410: + fcc = GST_MAKE_FOURCC ('Y', 'U', 'V', '9'); + break; + case V4L2_PIX_FMT_YUV420: + fcc = GST_MAKE_FOURCC ('I', '4', '2', '0'); + break; + case V4L2_PIX_FMT_YUYV: + fcc = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'); + break; + case V4L2_PIX_FMT_YVU420: + fcc = GST_MAKE_FOURCC ('Y', 'V', '1', '2'); + break; + case V4L2_PIX_FMT_UYVY: + fcc = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'); + break; + case V4L2_PIX_FMT_Y41P: + fcc = GST_MAKE_FOURCC ('Y', '4', '1', 'B'); + break; + default: + g_assert_not_reached (); + break; } structure = gst_structure_new ("video/x-raw-yuv", - "format", GST_TYPE_FOURCC, fcc, NULL); + "format", GST_TYPE_FOURCC, fcc, NULL); break; } case V4L2_PIX_FMT_DV: structure = - gst_structure_new ("video/x-dv", "systemstream", G_TYPE_BOOLEAN, TRUE, - NULL); + gst_structure_new ("video/x-dv", "systemstream", G_TYPE_BOOLEAN, TRUE, + NULL); break; - case V4L2_PIX_FMT_MPEG: /* MPEG */ + case V4L2_PIX_FMT_MPEG: /* MPEG */ /* someone figure out the MPEG format used... */ break; - case V4L2_PIX_FMT_WNVA: /* Winnov hw compres */ + case V4L2_PIX_FMT_WNVA: /* Winnov hw compres */ break; default: GST_DEBUG ("Unknown fourcc 0x%08x " GST_FOURCC_FORMAT, - fourcc, GST_FOURCC_ARGS (fourcc)); + fourcc, GST_FOURCC_ARGS (fourcc)); break; } #if 0 @@ -552,8 +553,8 @@ gst_v4l2src_get_format_from_fourcc (GstV4l2Src * v4l2src, guint32 fourcc) return fmt; /* special case for jpeg */ if ((fmt->pixelformat == V4L2_PIX_FMT_MJPEG && fourcc == V4L2_PIX_FMT_JPEG) - || (fmt->pixelformat == V4L2_PIX_FMT_JPEG - && fourcc == V4L2_PIX_FMT_MJPEG)) { + || (fmt->pixelformat == V4L2_PIX_FMT_JPEG + && fourcc == V4L2_PIX_FMT_MJPEG)) { return fmt; } walk = g_slist_next (walk); @@ -578,48 +579,48 @@ gst_v4l2_fourcc_from_structure (GstStructure * structure) switch (fourcc) { case GST_MAKE_FOURCC ('I', '4', '2', '0'): case GST_MAKE_FOURCC ('I', 'Y', 'U', 'V'): - fourcc = V4L2_PIX_FMT_YUV420; - break; + fourcc = V4L2_PIX_FMT_YUV420; + break; case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'): - fourcc = V4L2_PIX_FMT_YUYV; - break; + fourcc = V4L2_PIX_FMT_YUYV; + break; case GST_MAKE_FOURCC ('Y', '4', '1', 'P'): - fourcc = V4L2_PIX_FMT_Y41P; - break; + fourcc = V4L2_PIX_FMT_Y41P; + break; case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'): - fourcc = V4L2_PIX_FMT_UYVY; - break; + fourcc = V4L2_PIX_FMT_UYVY; + break; case GST_MAKE_FOURCC ('Y', 'V', '1', '2'): - fourcc = V4L2_PIX_FMT_YVU420; - break; + fourcc = V4L2_PIX_FMT_YVU420; + break; case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):{ - gint depth, endianness, r_mask; - - gst_structure_get_int (structure, "depth", &depth); - gst_structure_get_int (structure, "endianness", &endianness); - gst_structure_get_int (structure, "red_mask", &r_mask); - - switch (depth) { - case 8: - fourcc = V4L2_PIX_FMT_RGB332; - break; - case 15: - fourcc = (endianness == G_LITTLE_ENDIAN) ? - V4L2_PIX_FMT_RGB555 : V4L2_PIX_FMT_RGB555X; - break; - case 16: - fourcc = (endianness == G_LITTLE_ENDIAN) ? - V4L2_PIX_FMT_RGB565 : V4L2_PIX_FMT_RGB565X; - break; - case 24: - fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR24 : V4L2_PIX_FMT_RGB24; - break; - case 32: - fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR32 : V4L2_PIX_FMT_RGB32; - break; - } + gint depth, endianness, r_mask; + + gst_structure_get_int (structure, "depth", &depth); + gst_structure_get_int (structure, "endianness", &endianness); + gst_structure_get_int (structure, "red_mask", &r_mask); + + switch (depth) { + case 8: + fourcc = V4L2_PIX_FMT_RGB332; + break; + case 15: + fourcc = (endianness == G_LITTLE_ENDIAN) ? + V4L2_PIX_FMT_RGB555 : V4L2_PIX_FMT_RGB555X; + break; + case 16: + fourcc = (endianness == G_LITTLE_ENDIAN) ? + V4L2_PIX_FMT_RGB565 : V4L2_PIX_FMT_RGB565X; + break; + case 24: + fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR24 : V4L2_PIX_FMT_RGB24; + break; + case 32: + fourcc = (r_mask == 0xFF) ? V4L2_PIX_FMT_BGR32 : V4L2_PIX_FMT_RGB32; + break; + } default: - break; + break; } } } else if (strcmp (mimetype, "video/x-dv") == 0) { @@ -651,12 +652,12 @@ gst_v4l2src_get_all_caps (void) for (i = 0; i < GST_V4L2_FORMAT_COUNT; i++) { structure = gst_v4l2src_v4l2fourcc_to_caps (gst_v4l2_formats[i]); if (structure) { - gst_structure_set (structure, - "width", GST_TYPE_INT_RANGE, 1, 4096, - "height", GST_TYPE_INT_RANGE, 1, 4096, - "framerate", GST_TYPE_DOUBLE_RANGE, (double) 0, G_MAXDOUBLE, NULL); + gst_structure_set (structure, + "width", GST_TYPE_INT_RANGE, 1, 4096, + "height", GST_TYPE_INT_RANGE, 1, 4096, + "framerate", GST_TYPE_DOUBLE_RANGE, (double) 0, G_MAXDOUBLE, NULL); - gst_caps_append_structure (caps, structure); + gst_caps_append_structure (caps, structure); } } } @@ -680,8 +681,8 @@ gst_v4l2src_fixate (GstPad * pad, const GstCaps * const_caps) for (i = 0; i < gst_caps_get_size (caps); i++) { structure = gst_caps_get_structure (caps, i); changed |= - gst_caps_structure_fixate_field_nearest_int (structure, "width", - G_MAXINT); + gst_caps_structure_fixate_field_nearest_int (structure, "width", + G_MAXINT); } if (changed) return caps; @@ -689,8 +690,8 @@ gst_v4l2src_fixate (GstPad * pad, const GstCaps * const_caps) for (i = 0; i < gst_caps_get_size (caps); i++) { structure = gst_caps_get_structure (caps, i); changed |= - gst_caps_structure_fixate_field_nearest_int (structure, "height", - G_MAXINT); + gst_caps_structure_fixate_field_nearest_int (structure, "height", + G_MAXINT); } if (changed) return caps; @@ -764,7 +765,7 @@ gst_v4l2src_getcaps (GstPad * pad) /* get size delimiters */ if (!gst_v4l2src_get_size_limits (v4l2src, format, - &min_w, &max_w, &min_h, &max_h)) { + &min_w, &max_w, &min_h, &max_h)) { continue; } @@ -773,9 +774,9 @@ gst_v4l2src_getcaps (GstPad * pad) if (structure) { gst_structure_set (structure, - "width", GST_TYPE_INT_RANGE, min_w, max_w, - "height", GST_TYPE_INT_RANGE, min_h, max_h, - "framerate", GST_TYPE_DOUBLE_RANGE, (double) 0, G_MAXDOUBLE, NULL); + "width", GST_TYPE_INT_RANGE, min_w, max_w, + "height", GST_TYPE_INT_RANGE, min_h, max_h, + "framerate", GST_TYPE_DOUBLE_RANGE, (double) 0, G_MAXDOUBLE, NULL); gst_caps_append_structure (caps, structure); } @@ -796,7 +797,7 @@ gst_v4l2src_get (GstPad * pad) if (v4l2src->use_fixed_fps && (fps = gst_v4l2src_get_fps (v4l2src)) == 0) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, (NULL), - ("could not get frame rate for element")); + ("could not get frame rate for element")); return NULL; } @@ -818,69 +819,69 @@ gst_v4l2src_get (GstPad * pad) gboolean have_frame = FALSE; do { - /* FIXME: isn't this v4l2 timestamp its own clock?! */ - /* by default, we use the frame once */ - v4l2src->need_writes = 1; - - g_assert (time >= v4l2src->substract_time); - time -= v4l2src->substract_time; - - /* first check whether we lost any frames according to the device */ - if (v4l2src->last_seq != 0) { - if (v4l2src->pool->buffers[num].buffer.sequence - v4l2src->last_seq > - 1) { - v4l2src->need_writes = - v4l2src->pool->buffers[num].buffer.sequence - v4l2src->last_seq; - g_signal_emit (G_OBJECT (v4l2src), - gst_v4l2src_signals[SIGNAL_FRAME_LOST], 0, - v4l2src->need_writes - 1); - } - } - v4l2src->last_seq = v4l2src->pool->buffers[num].buffer.sequence; - - /* decide how often we're going to write the frame - set - * v4lmjpegsrc->need_writes to (that-1) and have_frame to TRUE - * if we're going to write it - else, just continue. - * - * time is generally the system or audio clock. Let's - * say that we've written one second of audio, then we want - * to have written one second of video too, within the same - * timeframe. This means that if time - begin_time = X sec, - * we want to have written X*fps frames. If we've written - * more - drop, if we've written less - dup... */ - if (v4l2src->handled * (GST_SECOND / fps) - time > - 1.5 * (GST_SECOND / fps)) { - /* yo dude, we've got too many frames here! Drop! DROP! */ - v4l2src->need_writes--; /* -= (v4l2src->handled - (time / fps)); */ - g_signal_emit (G_OBJECT (v4l2src), - gst_v4l2src_signals[SIGNAL_FRAME_DROP], 0); - } else if (v4l2src->handled * (GST_SECOND / fps) - time < - -1.5 * (GST_SECOND / fps)) { - /* this means we're lagging far behind */ - v4l2src->need_writes++; /* += ((time / fps) - v4l2src->handled); */ - g_signal_emit (G_OBJECT (v4l2src), - gst_v4l2src_signals[SIGNAL_FRAME_INSERT], 0); - } - - if (v4l2src->need_writes > 0) { - have_frame = TRUE; - v4l2src->need_writes--; - } else { - if (!gst_v4l2src_queue_frame (v4l2src, num)) - return NULL; - num = gst_v4l2src_grab_frame (v4l2src); - if (num == -1) - return NULL; - } + /* FIXME: isn't this v4l2 timestamp its own clock?! */ + /* by default, we use the frame once */ + v4l2src->need_writes = 1; + + g_assert (time >= v4l2src->substract_time); + time -= v4l2src->substract_time; + + /* first check whether we lost any frames according to the device */ + if (v4l2src->last_seq != 0) { + if (v4l2src->pool->buffers[num].buffer.sequence - v4l2src->last_seq > + 1) { + v4l2src->need_writes = + v4l2src->pool->buffers[num].buffer.sequence - v4l2src->last_seq; + g_signal_emit (G_OBJECT (v4l2src), + gst_v4l2src_signals[SIGNAL_FRAME_LOST], 0, + v4l2src->need_writes - 1); + } + } + v4l2src->last_seq = v4l2src->pool->buffers[num].buffer.sequence; + + /* decide how often we're going to write the frame - set + * v4lmjpegsrc->need_writes to (that-1) and have_frame to TRUE + * if we're going to write it - else, just continue. + * + * time is generally the system or audio clock. Let's + * say that we've written one second of audio, then we want + * to have written one second of video too, within the same + * timeframe. This means that if time - begin_time = X sec, + * we want to have written X*fps frames. If we've written + * more - drop, if we've written less - dup... */ + if (v4l2src->handled * (GST_SECOND / fps) - time > + 1.5 * (GST_SECOND / fps)) { + /* yo dude, we've got too many frames here! Drop! DROP! */ + v4l2src->need_writes--; /* -= (v4l2src->handled - (time / fps)); */ + g_signal_emit (G_OBJECT (v4l2src), + gst_v4l2src_signals[SIGNAL_FRAME_DROP], 0); + } else if (v4l2src->handled * (GST_SECOND / fps) - time < + -1.5 * (GST_SECOND / fps)) { + /* this means we're lagging far behind */ + v4l2src->need_writes++; /* += ((time / fps) - v4l2src->handled); */ + g_signal_emit (G_OBJECT (v4l2src), + gst_v4l2src_signals[SIGNAL_FRAME_INSERT], 0); + } + + if (v4l2src->need_writes > 0) { + have_frame = TRUE; + v4l2src->need_writes--; + } else { + if (!gst_v4l2src_queue_frame (v4l2src, num)) + return NULL; + num = gst_v4l2src_grab_frame (v4l2src); + if (num == -1) + return NULL; + } } while (!have_frame); } g_assert (num != -1); GST_LOG_OBJECT (v4l2src, "buffer %d needs %d writes", num, - v4l2src->need_writes + 1); + v4l2src->need_writes + 1); i = v4l2src->pool->buffers[num].buffer.bytesused > - 0 ? v4l2src->pool->buffers[num].buffer.bytesused : v4l2src->pool-> - buffers[num].length; + 0 ? v4l2src->pool->buffers[num].buffer.bytesused : v4l2src->pool-> + buffers[num].length; /* check if this is the last buffer in the queue. If so do a memcpy to put it back asap to avoid framedrops and deadlocks because of stupid elements */ if (gst_atomic_int_read (&v4l2src->pool->refcount) == v4l2src->breq.count) { @@ -888,8 +889,8 @@ gst_v4l2src_get (GstPad * pad) buf = gst_buffer_new_and_alloc (i); memcpy (GST_BUFFER_DATA (buf), v4l2src->pool->buffers[num].start, i); if (!gst_v4l2src_queue_frame (v4l2src, num)) { - gst_data_unref (GST_DATA (buf)); - return NULL; + gst_data_unref (GST_DATA (buf)); + return NULL; } } else { GST_LOG_OBJECT (v4l2src, "using mmap'd buffer"); @@ -909,13 +910,13 @@ gst_v4l2src_get (GstPad * pad) } else { /* calculate time based on our own clock */ GST_BUFFER_TIMESTAMP (buf) = - GST_TIMEVAL_TO_TIME (v4l2src->pool->buffers[num].buffer.timestamp) - - v4l2src->substract_time; + GST_TIMEVAL_TO_TIME (v4l2src->pool->buffers[num].buffer.timestamp) - + v4l2src->substract_time; } if (v4l2src->need_writes > 0) { v4l2src->cached_buffer = buf; for (i = 0; i < v4l2src->need_writes; i++) { - gst_data_ref (GST_DATA (buf)); + gst_data_ref (GST_DATA (buf)); } } } @@ -939,13 +940,13 @@ gst_v4l2src_set_property (GObject * object, switch (prop_id) { case ARG_NUMBUFS: if (!GST_V4L2_IS_ACTIVE (GST_V4L2ELEMENT (v4l2src))) { - v4l2src->breq.count = g_value_get_int (value); + v4l2src->breq.count = g_value_get_int (value); } break; case ARG_USE_FIXED_FPS: if (!GST_V4L2_IS_ACTIVE (GST_V4L2ELEMENT (v4l2src))) { - v4l2src->use_fixed_fps = g_value_get_boolean (value); + v4l2src->use_fixed_fps = g_value_get_boolean (value); } break; @@ -1005,7 +1006,7 @@ gst_v4l2src_change_state (GstElement * element) switch (transition) { case GST_STATE_NULL_TO_READY: if (!gst_v4l2src_get_capture (v4l2src)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; break; case GST_STATE_READY_TO_PAUSED: v4l2src->handled = 0; @@ -1016,24 +1017,24 @@ gst_v4l2src_change_state (GstElement * element) case GST_STATE_PAUSED_TO_PLAYING: /* queue all buffer, start streaming capture */ if (!gst_v4l2src_capture_start (v4l2src)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; g_get_current_time (&time); v4l2src->substract_time = GST_TIMEVAL_TO_TIME (time) - - v4l2src->substract_time; + v4l2src->substract_time; v4l2src->last_seq = 0; break; case GST_STATE_PLAYING_TO_PAUSED: g_get_current_time (&time); v4l2src->substract_time = GST_TIMEVAL_TO_TIME (time) - - v4l2src->substract_time; + v4l2src->substract_time; /* de-queue all queued buffers */ if (!gst_v4l2src_capture_stop (v4l2src)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; break; case GST_STATE_PAUSED_TO_READY: /* stop capturing, unmap all buffers */ if (!gst_v4l2src_capture_deinit (v4l2src)) - return GST_STATE_FAILURE; + return GST_STATE_FAILURE; break; case GST_STATE_READY_TO_NULL: break; diff --git a/sys/v4l2/gstv4l2tuner.c b/sys/v4l2/gstv4l2tuner.c index 5d5626f2..79e3214b 100644 --- a/sys/v4l2/gstv4l2tuner.c +++ b/sys/v4l2/gstv4l2tuner.c @@ -76,8 +76,8 @@ gst_v4l2_tuner_channel_get_type (void) }; gst_v4l2_tuner_channel_type = - g_type_register_static (GST_TYPE_TUNER_CHANNEL, - "GstV4l2TunerChannel", &v4l2_tuner_channel_info, 0); + g_type_register_static (GST_TYPE_TUNER_CHANNEL, + "GstV4l2TunerChannel", &v4l2_tuner_channel_info, 0); } return gst_v4l2_tuner_channel_type; @@ -117,8 +117,8 @@ gst_v4l2_tuner_norm_get_type (void) }; gst_v4l2_tuner_norm_type = - g_type_register_static (GST_TYPE_TUNER_NORM, - "GstV4l2TunerNorm", &v4l2_tuner_norm_info, 0); + g_type_register_static (GST_TYPE_TUNER_NORM, + "GstV4l2TunerNorm", &v4l2_tuner_norm_info, 0); } return gst_v4l2_tuner_norm_type; @@ -295,7 +295,7 @@ gst_v4l2_tuner_set_frequency (GstTuner * mixer, /* assert that we're opened and that we're using a known item */ g_return_if_fail (GST_V4L2_IS_OPEN (v4l2element)); g_return_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel, - GST_TUNER_CHANNEL_FREQUENCY)); + GST_TUNER_CHANNEL_FREQUENCY)); g_return_if_fail (gst_v4l2_tuner_contains_channel (v4l2element, v4l2channel)); gst_v4l2_get_input (v4l2element, &chan); @@ -319,9 +319,9 @@ gst_v4l2_tuner_get_frequency (GstTuner * mixer, GstTunerChannel * channel) /* assert that we're opened and that we're using a known item */ g_return_val_if_fail (GST_V4L2_IS_OPEN (v4l2element), 0); g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel, - GST_TUNER_CHANNEL_FREQUENCY), 0); + GST_TUNER_CHANNEL_FREQUENCY), 0); g_return_val_if_fail (gst_v4l2_tuner_contains_channel (v4l2element, - v4l2channel), 0); + v4l2channel), 0); gst_v4l2_get_input (v4l2element, &chan); if (chan == GST_V4L2_TUNER_CHANNEL (channel)->index && @@ -343,9 +343,9 @@ gst_v4l2_tuner_signal_strength (GstTuner * mixer, GstTunerChannel * channel) /* assert that we're opened and that we're using a known item */ g_return_val_if_fail (GST_V4L2_IS_OPEN (v4l2element), 0); g_return_val_if_fail (GST_TUNER_CHANNEL_HAS_FLAG (channel, - GST_TUNER_CHANNEL_FREQUENCY), 0); + GST_TUNER_CHANNEL_FREQUENCY), 0); g_return_val_if_fail (gst_v4l2_tuner_contains_channel (v4l2element, - v4l2channel), 0); + v4l2channel), 0); gst_v4l2_get_input (v4l2element, &chan); if (chan == GST_V4L2_TUNER_CHANNEL (channel)->index && diff --git a/sys/v4l2/gstv4l2xoverlay.c b/sys/v4l2/gstv4l2xoverlay.c index 1af62cc1..515d8463 100644 --- a/sys/v4l2/gstv4l2xoverlay.c +++ b/sys/v4l2/gstv4l2xoverlay.c @@ -72,7 +72,7 @@ gst_v4l2_xoverlay_open (GstV4l2Element * v4l2element) xwin->display_name = g_strdup (v4l2element->display); if (v4l2element->xwindow_id != 0 && - xwin->display_name && xwin->display_name[0] == ':') { + xwin->display_name && xwin->display_name[0] == ':') { gst_x_window_listener_set_xid (xwin, v4l2element->xwindow_id); } } @@ -85,7 +85,7 @@ gst_v4l2_xoverlay_close (GstV4l2Element * v4l2element) if (xwin != NULL) { if (v4l2element->xwindow_id != 0 && - xwin->display_name && xwin->display_name[0] == ':') { + xwin->display_name && xwin->display_name[0] == ':') { gst_x_window_listener_set_xid (xwin, 0); } diff --git a/sys/v4l2/v4l2-overlay_calls.c b/sys/v4l2/v4l2-overlay_calls.c index d4a10ab7..0876879d 100644 --- a/sys/v4l2/v4l2-overlay_calls.c +++ b/sys/v4l2/v4l2-overlay_calls.c @@ -60,14 +60,14 @@ gst_v4l2_set_display (GstV4l2Element * v4l2element) switch (system (buff)) { case -1: GST_ELEMENT_ERROR (v4l2element, RESOURCE, FAILED, - (_("Could not start v4l-conf.")), GST_ERROR_SYSTEM); + (_("Could not start v4l-conf.")), GST_ERROR_SYSTEM); g_free (buff); return FALSE; case 0: break; default: GST_ELEMENT_ERROR (v4l2element, RESOURCE, FAILED, - (_("Executing v4l-conf failed.")), GST_ERROR_SYSTEM); + (_("Executing v4l-conf failed.")), GST_ERROR_SYSTEM); g_free (buff); return FALSE; } @@ -106,7 +106,7 @@ gst_v4l2_set_window (GstElement * element, if (ioctl (v4l2element->video_fd, VIDIOC_S_FMT, &fmt) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, TOO_LAZY, (NULL), - ("Failed to set the video window: %s", g_strerror (errno))); + ("Failed to set the video window: %s", g_strerror (errno))); return FALSE; } @@ -131,8 +131,8 @@ gst_v4l2_enable_overlay (GstV4l2Element * v4l2element, gboolean enable) if (ioctl (v4l2element->video_fd, VIDIOC_OVERLAY, &doit) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, TOO_LAZY, (NULL), - ("Failed to %s overlay display: %s", - enable ? "enable" : "disable", g_strerror (errno))); + ("Failed to %s overlay display: %s", + enable ? "enable" : "disable", g_strerror (errno))); return FALSE; } diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c index f75ea550..92de8a42 100644 --- a/sys/v4l2/v4l2_calls.c +++ b/sys/v4l2/v4l2_calls.c @@ -56,8 +56,8 @@ gst_v4l2_get_capabilities (GstV4l2Element * v4l2element) if (ioctl (v4l2element->video_fd, VIDIOC_QUERYCAP, &(v4l2element->vcap)) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Error getting %s capabilities: %s", - v4l2element->device, g_strerror (errno))); + ("Error getting %s capabilities: %s", + v4l2element->device, g_strerror (errno))); return FALSE; } @@ -94,14 +94,14 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) input.index = n; if (ioctl (v4l2element->video_fd, VIDIOC_ENUMINPUT, &input) < 0) { - if (errno == EINVAL) - break; /* end of enumeration */ - else { - GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get %d in input enumeration for %s: %s", - n, v4l2element->device, g_strerror (errno))); - return FALSE; - } + if (errno == EINVAL) + break; /* end of enumeration */ + else { + GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), + ("Failed to get %d in input enumeration for %s: %s", + n, v4l2element->device, g_strerror (errno))); + return FALSE; + } } v4l2channel = g_object_new (GST_TYPE_V4L2_TUNER_CHANNEL, NULL); @@ -110,34 +110,34 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) channel->flags = GST_TUNER_CHANNEL_INPUT; v4l2channel->index = n; if (input.type == V4L2_INPUT_TYPE_TUNER) { - struct v4l2_tuner vtun; - - v4l2channel->tuner = input.tuner; - channel->flags |= GST_TUNER_CHANNEL_FREQUENCY; - - vtun.index = input.tuner; - if (ioctl (v4l2element->video_fd, VIDIOC_G_TUNER, &vtun) < 0) { - GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get tuner %d settings on %s: %s", - input.tuner, v4l2element->device, g_strerror (errno))); - g_object_unref (G_OBJECT (channel)); - return FALSE; - } - channel->min_frequency = vtun.rangelow; - channel->max_frequency = vtun.rangehigh; - channel->min_signal = 0; - channel->max_signal = 0xffff; + struct v4l2_tuner vtun; + + v4l2channel->tuner = input.tuner; + channel->flags |= GST_TUNER_CHANNEL_FREQUENCY; + + vtun.index = input.tuner; + if (ioctl (v4l2element->video_fd, VIDIOC_G_TUNER, &vtun) < 0) { + GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), + ("Failed to get tuner %d settings on %s: %s", + input.tuner, v4l2element->device, g_strerror (errno))); + g_object_unref (G_OBJECT (channel)); + return FALSE; + } + channel->min_frequency = vtun.rangelow; + channel->max_frequency = vtun.rangehigh; + channel->min_signal = 0; + channel->max_signal = 0xffff; } if (input.audioset) { - /* we take the first. We don't care for - * the others for now */ - while (!(input.audioset & (1 << v4l2channel->audio))) - v4l2channel->audio++; - channel->flags |= GST_TUNER_CHANNEL_AUDIO; + /* we take the first. We don't care for + * the others for now */ + while (!(input.audioset & (1 << v4l2channel->audio))) + v4l2channel->audio++; + channel->flags |= GST_TUNER_CHANNEL_AUDIO; } v4l2element->channels = - g_list_append (v4l2element->channels, (gpointer) channel); + g_list_append (v4l2element->channels, (gpointer) channel); } } else { /* outputs */ @@ -148,14 +148,14 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) output.index = n; if (ioctl (v4l2element->video_fd, VIDIOC_ENUMOUTPUT, &output) < 0) { - if (errno == EINVAL) - break; /* end of enumeration */ - else { - GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get %d in output enumeration for %s: %s", - n, v4l2element->device, g_strerror (errno))); - return FALSE; - } + if (errno == EINVAL) + break; /* end of enumeration */ + else { + GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), + ("Failed to get %d in output enumeration for %s: %s", + n, v4l2element->device, g_strerror (errno))); + return FALSE; + } } v4l2channel = g_object_new (GST_TYPE_V4L2_TUNER_CHANNEL, NULL); @@ -164,15 +164,15 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) channel->flags = GST_TUNER_CHANNEL_OUTPUT; v4l2channel->index = n; if (output.audioset) { - /* we take the first. We don't care for - * the others for now */ - while (!(output.audioset & (1 << v4l2channel->audio))) - v4l2channel->audio++; - channel->flags |= GST_TUNER_CHANNEL_AUDIO; + /* we take the first. We don't care for + * the others for now */ + while (!(output.audioset & (1 << v4l2channel->audio))) + v4l2channel->audio++; + channel->flags |= GST_TUNER_CHANNEL_AUDIO; } v4l2element->channels = - g_list_append (v4l2element->channels, (gpointer) channel); + g_list_append (v4l2element->channels, (gpointer) channel); } } @@ -185,12 +185,12 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) standard.index = n; if (ioctl (v4l2element->video_fd, VIDIOC_ENUMSTD, &standard) < 0) { if (errno == EINVAL) - break; /* end of enumeration */ + break; /* end of enumeration */ else { - GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get %d in norm enumeration for %s: %s", - n, v4l2element->device, g_strerror (errno))); - return FALSE; + GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), + ("Failed to get %d in norm enumeration for %s: %s", + n, v4l2element->device, g_strerror (errno))); + return FALSE; } } @@ -198,7 +198,7 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) norm = GST_TUNER_NORM (v4l2norm); norm->label = g_strdup (standard.name); norm->fps = (gfloat) standard.frameperiod.denominator / - standard.frameperiod.numerator; + standard.frameperiod.numerator; v4l2norm->index = standard.id; v4l2element->norms = g_list_append (v4l2element->norms, (gpointer) norm); @@ -217,15 +217,15 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) control.id = n; if (ioctl (v4l2element->video_fd, VIDIOC_QUERYCTRL, &control) < 0) { if (errno == EINVAL) { - if (n < V4L2_CID_PRIVATE_BASE) - continue; - else - break; + if (n < V4L2_CID_PRIVATE_BASE) + continue; + else + break; } else { - GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get %d in control enumeration for %s: %s", - n, v4l2element->device, g_strerror (errno))); - return FALSE; + GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), + ("Failed to get %d in control enumeration for %s: %s", + n, v4l2element->device, g_strerror (errno))); + return FALSE; } } if (control.flags & V4L2_CTRL_FLAG_DISABLED) @@ -245,12 +245,12 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) case V4L2_CID_EXPOSURE: case V4L2_CID_AUTOGAIN: case V4L2_CID_GAIN: - /* we only handle these for now */ - break; + /* we only handle these for now */ + break; default: - DEBUG ("ControlID %s (%d) unhandled, FIXME", control.name, n); - control.id++; - break; + DEBUG ("ControlID %s (%d) unhandled, FIXME", control.name, n); + control.id++; + break; } if (n != control.id) continue; @@ -267,20 +267,20 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) menu.id = n; for (i = 0;; i++) { - menu.index = i; - if (ioctl (v4l2element->video_fd, VIDIOC_QUERYMENU, &menu) < 0) { - if (errno == EINVAL) - break; /* end of enumeration */ - else { - GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get %d in menu enumeration for %s: %s", - n, v4l2element->device, g_strerror (errno))); - return FALSE; - } - } - mptr = g_malloc (sizeof (menu)); - memcpy (mptr, &menu, sizeof (menu)); - menus = g_list_append (menus, mptr); + menu.index = i; + if (ioctl (v4l2element->video_fd, VIDIOC_QUERYMENU, &menu) < 0) { + if (errno == EINVAL) + break; /* end of enumeration */ + else { + GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), + ("Failed to get %d in menu enumeration for %s: %s", + n, v4l2element->device, g_strerror (errno))); + return FALSE; + } + } + mptr = g_malloc (sizeof (menu)); + memcpy (mptr, &menu, sizeof (menu)); + menus = g_list_append (menus, mptr); } } v4l2element->menus = g_list_append (v4l2element->menus, menus); @@ -288,20 +288,20 @@ gst_v4l2_fill_lists (GstV4l2Element * v4l2element) switch (control.type) { case V4L2_CTRL_TYPE_INTEGER: - channel->min_value = control.minimum; - channel->max_value = control.maximum; - break; + channel->min_value = control.minimum; + channel->max_value = control.maximum; + break; case V4L2_CTRL_TYPE_BOOLEAN: - channel->min_value = FALSE; - channel->max_value = TRUE; - break; + channel->min_value = FALSE; + channel->max_value = TRUE; + break; default: - channel->min_value = channel->max_value = 0; - break; + channel->min_value = channel->max_value = 0; + break; } v4l2element->colors = g_list_append (v4l2element->colors, - (gpointer) channel); + (gpointer) channel); } return TRUE; @@ -352,7 +352,7 @@ gst_v4l2_set_defaults (GstV4l2Element * v4l2element) gst_tuner_set_channel (tuner, channel); } else { channel = - GST_TUNER_CHANNEL (gst_tuner_get_channel (GST_TUNER (v4l2element))); + GST_TUNER_CHANNEL (gst_tuner_get_channel (GST_TUNER (v4l2element))); v4l2element->channel = g_strdup (channel->label); gst_tuner_channel_changed (tuner, channel); g_object_notify (G_OBJECT (v4l2element), "channel"); @@ -392,8 +392,8 @@ gst_v4l2_open (GstV4l2Element * v4l2element) v4l2element->video_fd = open (v4l2element->device, O_RDWR); if (!GST_V4L2_IS_OPEN (v4l2element)) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, OPEN_READ_WRITE, - (_("Could not open device \"%s\" for reading and writing."), - v4l2element->device), GST_ERROR_SYSTEM); + (_("Could not open device \"%s\" for reading and writing."), + v4l2element->device), GST_ERROR_SYSTEM); goto error; } @@ -406,8 +406,8 @@ gst_v4l2_open (GstV4l2Element * v4l2element) if (GST_IS_V4L2SRC (v4l2element) && !(v4l2element->vcap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, NOT_FOUND, - (_("Device \"%s\" is not a capture device."), v4l2element->device), - ("Capabilities: 0x%x", v4l2element->vcap.capabilities)); + (_("Device \"%s\" is not a capture device."), v4l2element->device), + ("Capabilities: 0x%x", v4l2element->vcap.capabilities)); goto error; } @@ -474,8 +474,8 @@ gst_v4l2_get_norm (GstV4l2Element * v4l2element, v4l2_std_id * norm) if (ioctl (v4l2element->video_fd, VIDIOC_G_STD, norm) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get the current norm for device %s: %s", - v4l2element->device, g_strerror (errno))); + ("Failed to get the current norm for device %s: %s", + v4l2element->device, g_strerror (errno))); return FALSE; } @@ -498,8 +498,8 @@ gst_v4l2_set_norm (GstV4l2Element * v4l2element, v4l2_std_id norm) if (ioctl (v4l2element->video_fd, VIDIOC_S_STD, &norm) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to set norm 0x%llx for device %s: %s", - norm, v4l2element->device, g_strerror (errno))); + ("Failed to set norm 0x%llx for device %s: %s", + norm, v4l2element->device, g_strerror (errno))); return FALSE; } @@ -523,8 +523,8 @@ gst_v4l2_get_input (GstV4l2Element * v4l2element, gint * input) if (ioctl (v4l2element->video_fd, VIDIOC_G_INPUT, &n) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get current input on device %s: %s", - v4l2element->device, g_strerror (errno))); + ("Failed to get current input on device %s: %s", + v4l2element->device, g_strerror (errno))); return FALSE; } @@ -549,8 +549,8 @@ gst_v4l2_set_input (GstV4l2Element * v4l2element, gint input) if (ioctl (v4l2element->video_fd, VIDIOC_S_INPUT, &input) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to set input %d on device %s: %s", - input, v4l2element->device, g_strerror (errno))); + ("Failed to set input %d on device %s: %s", + input, v4l2element->device, g_strerror (errno))); return FALSE; } @@ -574,8 +574,8 @@ gst_v4l2_get_output (GstV4l2Element * v4l2element, gint * output) if (ioctl (v4l2element->video_fd, VIDIOC_G_OUTPUT, &n) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get current output on device %s: %s", - v4l2element->device, g_strerror (errno))); + ("Failed to get current output on device %s: %s", + v4l2element->device, g_strerror (errno))); return FALSE; } @@ -600,8 +600,8 @@ gst_v4l2_set_output (GstV4l2Element * v4l2element, gint output) if (ioctl (v4l2element->video_fd, VIDIOC_S_OUTPUT, &output) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to set output %d on device %s: %s", - output, v4l2element->device, g_strerror (errno))); + ("Failed to set output %d on device %s: %s", + output, v4l2element->device, g_strerror (errno))); return FALSE; } @@ -627,8 +627,8 @@ gst_v4l2_get_frequency (GstV4l2Element * v4l2element, freq.tuner = tunernum; if (ioctl (v4l2element->video_fd, VIDIOC_G_FREQUENCY, &freq) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get current tuner frequency for device %s: %s", - v4l2element->device, g_strerror (errno))); + ("Failed to get current tuner frequency for device %s: %s", + v4l2element->device, g_strerror (errno))); return FALSE; } @@ -661,8 +661,8 @@ gst_v4l2_set_frequency (GstV4l2Element * v4l2element, if (ioctl (v4l2element->video_fd, VIDIOC_S_FREQUENCY, &freq) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to set tuner frequency to %lu for device %s: %s", - frequency, v4l2element->device, g_strerror (errno))); + ("Failed to set tuner frequency to %lu for device %s: %s", + frequency, v4l2element->device, g_strerror (errno))); return FALSE; } @@ -688,8 +688,8 @@ gst_v4l2_signal_strength (GstV4l2Element * v4l2element, tuner.index = tunernum; if (ioctl (v4l2element->video_fd, VIDIOC_G_TUNER, &tuner) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get signal strength for device %s: %s", - v4l2element->device, g_strerror (errno))); + ("Failed to get signal strength for device %s: %s", + v4l2element->device, g_strerror (errno))); return FALSE; } @@ -719,8 +719,8 @@ gst_v4l2_get_attribute (GstV4l2Element * v4l2element, if (ioctl (v4l2element->video_fd, VIDIOC_G_CTRL, &control) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to get value for control %d on device %s: %s", - attribute_num, v4l2element->device, g_strerror (errno))); + ("Failed to get value for control %d on device %s: %s", + attribute_num, v4l2element->device, g_strerror (errno))); return FALSE; } @@ -751,8 +751,8 @@ gst_v4l2_set_attribute (GstV4l2Element * v4l2element, if (ioctl (v4l2element->video_fd, VIDIOC_S_CTRL, &control) < 0) { GST_ELEMENT_ERROR (v4l2element, RESOURCE, SETTINGS, (NULL), - ("Failed to set value %d for control %d on device %s: %s", - value, attribute_num, v4l2element->device, g_strerror (errno))); + ("Failed to set value %d for control %d on device %s: %s", + value, attribute_num, v4l2element->device, g_strerror (errno))); return FALSE; } diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c index 00d710eb..a2db4f2b 100644 --- a/sys/v4l2/v4l2src_calls.c +++ b/sys/v4l2/v4l2src_calls.c @@ -70,19 +70,19 @@ gst_v4l2src_fill_format_list (GstV4l2Src * v4l2src) format->index = n; format->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_ENUM_FMT, - format) < 0) { + format) < 0) { if (errno == EINVAL) { - break; /* end of enumeration */ + break; /* end of enumeration */ } else { - GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, (NULL), - ("failed to get number %d in pixelformat enumeration for %s: %s", - n, GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); - g_free (format); - return FALSE; + GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, (NULL), + ("failed to get number %d in pixelformat enumeration for %s: %s", + n, GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); + g_free (format); + return FALSE; } } GST_LOG_OBJECT (v4l2src, "got format" GST_FOURCC_FORMAT, - GST_FOURCC_ARGS (format->pixelformat)); + GST_FOURCC_ARGS (format->pixelformat)); v4l2src->formats = g_slist_prepend (v4l2src->formats, format); } @@ -118,11 +118,11 @@ gst_v4l2src_queue_frame (GstV4l2Src * v4l2src, guint i) GST_LOG_OBJECT (v4l2src, "queueing frame %u", i); if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_QBUF, - &v4l2src->pool->buffers[i].buffer) < 0) { + &v4l2src->pool->buffers[i].buffer) < 0) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, WRITE, - (_("Could not write to device \"%s\"."), - GST_V4L2ELEMENT (v4l2src)->device), - ("Error queueing buffer %u on device %s", i, g_strerror (errno))); + (_("Could not write to device \"%s\"."), + GST_V4L2ELEMENT (v4l2src)->device), + ("Error queueing buffer %u on device %s", i, g_strerror (errno))); return FALSE; } @@ -146,8 +146,8 @@ gst_v4l2src_grab_frame (GstV4l2Src * v4l2src) /* if the sync() got interrupted, we can retry */ if (errno != EINTR) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, SYNC, (NULL), - ("could not sync on a buffer on device %s: %s", - GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); + ("could not sync on a buffer on device %s: %s", + GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); return -1; } GST_DEBUG_OBJECT (v4l2src, "grab got interrupted"); @@ -174,10 +174,10 @@ gst_v4l2src_get_capture (GstV4l2Src * v4l2src) v4l2src->format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_G_FMT, - &v4l2src->format) < 0) { + &v4l2src->format) < 0) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, (NULL), - ("failed to get pixelformat for device %s: %s", - GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); + ("failed to get pixelformat for device %s: %s", + GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); return FALSE; } @@ -209,11 +209,11 @@ gst_v4l2src_set_capture (GstV4l2Src * v4l2src, v4l2src->format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_S_FMT, - &v4l2src->format) < 0) { + &v4l2src->format) < 0) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, (NULL), - ("failed to set pixelformat to %s @ %dx%d for device %s: %s", - fmt->description, width, height, GST_V4L2ELEMENT (v4l2src)->device, - g_strerror (errno))); + ("failed to set pixelformat to %s @ %dx%d for device %s: %s", + fmt->description, width, height, GST_V4L2ELEMENT (v4l2src)->device, + g_strerror (errno))); return FALSE; } @@ -250,21 +250,21 @@ gst_v4l2src_capture_init (GstV4l2Src * v4l2src) v4l2src->breq.type = v4l2src->format.type; v4l2src->breq.memory = V4L2_MEMORY_MMAP; if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_REQBUFS, - &v4l2src->breq) < 0) { + &v4l2src->breq) < 0) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ, - (_("Could not get buffers from device \"%s\"."), - GST_V4L2ELEMENT (v4l2src)->device), - ("error requesting %d buffers: %s", v4l2src->breq.count, - g_strerror (errno))); + (_("Could not get buffers from device \"%s\"."), + GST_V4L2ELEMENT (v4l2src)->device), + ("error requesting %d buffers: %s", v4l2src->breq.count, + g_strerror (errno))); return FALSE; } if (v4l2src->breq.count < GST_V4L2_MIN_BUFFERS) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ, - (_("Could not get enough buffers from device \"%s\"."), - GST_V4L2ELEMENT (v4l2src)->device), - ("we received %d, we want at least %d", v4l2src->breq.count, - GST_V4L2_MIN_BUFFERS)); + (_("Could not get enough buffers from device \"%s\"."), + GST_V4L2ELEMENT (v4l2src)->device), + ("we received %d, we want at least %d", v4l2src->breq.count, + GST_V4L2_MIN_BUFFERS)); v4l2src->breq.count = buffers; return FALSE; } @@ -292,19 +292,19 @@ gst_v4l2src_capture_init (GstV4l2Src * v4l2src) buffer->buffer.index = n; buffer->buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_QUERYBUF, - &buffer->buffer) < 0) { + &buffer->buffer) < 0) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ, (NULL), - ("Could not get buffer properties of buffer %d: %s", n, - g_strerror (errno))); + ("Could not get buffer properties of buffer %d: %s", n, + g_strerror (errno))); gst_v4l2src_capture_deinit (v4l2src); return FALSE; } buffer->start = - mmap (0, buffer->buffer.length, PROT_READ | PROT_WRITE, MAP_SHARED, - GST_V4L2ELEMENT (v4l2src)->video_fd, buffer->buffer.m.offset); + mmap (0, buffer->buffer.length, PROT_READ | PROT_WRITE, MAP_SHARED, + GST_V4L2ELEMENT (v4l2src)->video_fd, buffer->buffer.m.offset); if (buffer->start == MAP_FAILED) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ, (NULL), - ("Could not mmap video buffer %d: %s", n, g_strerror (errno))); + ("Could not mmap video buffer %d: %s", n, g_strerror (errno))); buffer->start = 0; gst_v4l2src_capture_deinit (v4l2src); return FALSE; @@ -344,8 +344,8 @@ gst_v4l2src_capture_start (GstV4l2Src * v4l2src) if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_STREAMON, &type) < 0) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, OPEN_READ, (NULL), - ("Error starting streaming capture from device %s: %s", - GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); + ("Error starting streaming capture from device %s: %s", + GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); return FALSE; } @@ -372,8 +372,8 @@ gst_v4l2src_capture_stop (GstV4l2Src * v4l2src) * on the non-queued ones */ if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_STREAMOFF, &type) < 0) { GST_ELEMENT_ERROR (v4l2src, RESOURCE, CLOSE, (NULL), - ("Error stopping streaming capture from device %s: %s", - GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); + ("Error stopping streaming capture from device %s: %s", + GST_V4L2ELEMENT (v4l2src)->device, g_strerror (errno))); return FALSE; } @@ -445,7 +445,7 @@ gst_v4l2src_capture_deinit (GstV4l2Src * v4l2src) buffer.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (ioctl (GST_V4L2ELEMENT (v4l2src)->video_fd, VIDIOC_DQBUF, &buffer) < 0) GST_WARNING_OBJECT (v4l2src, - "Could not dequeue buffer on uninitialization"); + "Could not dequeue buffer on uninitialization"); } if (gst_atomic_int_dec_and_test (&v4l2src->pool->refcount)) { /* we're last thing that used all this */ |