~ubuntu-branches/ubuntu/feisty/gst-plugins-good0.10/feisty-security

« back to all changes in this revision

Viewing changes to sys/v4l2/gstv4l2colorbalance.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastian Dröge
  • Date: 2006-12-21 21:12:15 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20061221211215-3uukkusokhe0nk4f
Tags: 0.10.5-0ubuntu1
* Sync with pkg-gstreamer SVN:
  + debian/rules:
    - Use Ubuntu as distribution name and point to the proper Launchpad URL
  + debian/patches/01_esdsink-priority.patch:
    - Mark the esdsink with rank primary-2 to get
      pulse > alsadmix > esd > alsa > oss

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GStreamer
 
2
 *
 
3
 * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
 
4
 *               2006 Edgard Lima <edgard.lima@indt.org.br>
 
5
 *
 
6
 * gstv4l2colorbalance.c: color balance interface implementation for V4L2
 
7
 *
 
8
 * This library is free software; you can redistribute it and/or
 
9
 * modify it under the terms of the GNU Library General Public
 
10
 * License as published by the Free Software Foundation; either
 
11
 * version 2 of the License, or (at your option) any later version.
 
12
 *
 
13
 * This library is distributed in the hope that it will be useful,
 
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
16
 * Library General Public License for more details.
 
17
 *
 
18
 * You should have received a copy of the GNU Library General Public
 
19
 * License along with this library; if not, write to the
 
20
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
21
 * Boston, MA 02111-1307, USA.
 
22
 */
 
23
 
 
24
#ifdef HAVE_CONFIG_H
 
25
#include "config.h"
 
26
#endif
 
27
 
 
28
#include <gst/gst.h>
 
29
#include "gstv4l2colorbalance.h"
 
30
#include "gstv4l2object.h"
 
31
 
 
32
GST_BOILERPLATE (GstV4l2ColorBalanceChannel,
 
33
    gst_v4l2_color_balance_channel,
 
34
    GstColorBalanceChannel, GST_TYPE_COLOR_BALANCE_CHANNEL);
 
35
 
 
36
static void
 
37
gst_v4l2_color_balance_channel_base_init (gpointer g_class)
 
38
{
 
39
}
 
40
 
 
41
static void
 
42
gst_v4l2_color_balance_channel_class_init (GstV4l2ColorBalanceChannelClass *
 
43
    klass)
 
44
{
 
45
}
 
46
 
 
47
static void
 
48
gst_v4l2_color_balance_channel_init (GstV4l2ColorBalanceChannel * channel,
 
49
    GstV4l2ColorBalanceChannelClass * klass)
 
50
{
 
51
  channel->id = (guint32) - 1;
 
52
}
 
53
 
 
54
static G_GNUC_UNUSED gboolean
 
55
gst_v4l2_color_balance_contains_channel (GstV4l2Object * v4l2object,
 
56
    GstV4l2ColorBalanceChannel * v4l2channel)
 
57
{
 
58
  const GList *item;
 
59
 
 
60
  for (item = v4l2object->colors; item != NULL; item = item->next)
 
61
    if (item->data == v4l2channel)
 
62
      return TRUE;
 
63
 
 
64
  return FALSE;
 
65
}
 
66
 
 
67
const GList *
 
68
gst_v4l2_color_balance_list_channels (GstV4l2Object * v4l2object)
 
69
{
 
70
  return v4l2object->colors;
 
71
}
 
72
 
 
73
void
 
74
gst_v4l2_color_balance_set_value (GstV4l2Object * v4l2object,
 
75
    GstColorBalanceChannel * channel, gint value)
 
76
{
 
77
 
 
78
  GstV4l2ColorBalanceChannel *v4l2channel =
 
79
      GST_V4L2_COLOR_BALANCE_CHANNEL (channel);
 
80
 
 
81
  /* assert that we're opened and that we're using a known item */
 
82
  g_return_if_fail (GST_V4L2_IS_OPEN (v4l2object));
 
83
  g_return_if_fail (gst_v4l2_color_balance_contains_channel (v4l2object,
 
84
          v4l2channel));
 
85
 
 
86
  gst_v4l2_set_attribute (v4l2object, v4l2channel->id, value);
 
87
}
 
88
 
 
89
gint
 
90
gst_v4l2_color_balance_get_value (GstV4l2Object * v4l2object,
 
91
    GstColorBalanceChannel * channel)
 
92
{
 
93
  GstV4l2ColorBalanceChannel *v4l2channel =
 
94
      GST_V4L2_COLOR_BALANCE_CHANNEL (channel);
 
95
  gint value;
 
96
 
 
97
  /* assert that we're opened and that we're using a known item */
 
98
  g_return_val_if_fail (GST_V4L2_IS_OPEN (v4l2object), 0);
 
99
  g_return_val_if_fail (gst_v4l2_color_balance_contains_channel (v4l2object,
 
100
          v4l2channel), 0);
 
101
 
 
102
  if (!gst_v4l2_get_attribute (v4l2object, v4l2channel->id, &value))
 
103
    return 0;
 
104
 
 
105
  return value;
 
106
}