gst_plugins_good/gst/camerabin/gstcamerabincolorbalance.c
branchGCC_SURGE
changeset 25 7ce29e50e9e1
parent 12 fae53e47b8b4
parent 23 29ecd5cb86b3
equal deleted inserted replaced
12:fae53e47b8b4 25:7ce29e50e9e1
     1 /*
       
     2  * GStreamer
       
     3  * Copyright (C) 2008 Nokia Corporation <multimedia@maemo.org>
       
     4  *
       
     5  * This library is free software; you can redistribute it and/or
       
     6  * modify it under the terms of the GNU Library General Public
       
     7  * License as published by the Free Software Foundation; either
       
     8  * version 2 of the License, or (at your option) any later version.
       
     9  *
       
    10  * This library is distributed in the hope that it will be useful,
       
    11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    13  * Library General Public License for more details.
       
    14  *
       
    15  * You should have received a copy of the GNU Library General Public
       
    16  * License along with this library; if not, write to the
       
    17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    18  * Boston, MA 02111-1307, USA.
       
    19  */
       
    20 
       
    21 /*
       
    22  * Includes
       
    23  */
       
    24 
       
    25 #ifdef HAVE_CONFIG_H
       
    26 #include <config.h>
       
    27 #endif
       
    28 
       
    29 #include "gstcamerabincolorbalance.h"
       
    30 #include "gstcamerabin.h"
       
    31 
       
    32 /*
       
    33  * static functions implementation
       
    34  */
       
    35 
       
    36 static const GList *
       
    37 gst_camerabin_color_balance_list_channels (GstColorBalance * cb)
       
    38 {
       
    39   if (cb && GST_CAMERABIN (cb)->src_vid_src) {
       
    40     GstColorBalance *cbl = GST_COLOR_BALANCE (GST_CAMERABIN (cb)->src_vid_src);
       
    41     return gst_color_balance_list_channels (cbl);
       
    42   } else {
       
    43     return NULL;
       
    44   }
       
    45 }
       
    46 
       
    47 static void
       
    48 gst_camerabin_color_balance_set_value (GstColorBalance * cb,
       
    49     GstColorBalanceChannel * channel, gint value)
       
    50 {
       
    51   if (cb && GST_CAMERABIN (cb)->src_vid_src) {
       
    52     GstColorBalance *cbl = GST_COLOR_BALANCE (GST_CAMERABIN (cb)->src_vid_src);
       
    53     gst_color_balance_set_value (cbl, channel, value);
       
    54   }
       
    55 }
       
    56 
       
    57 static gint
       
    58 gst_camerabin_color_balance_get_value (GstColorBalance * cb,
       
    59     GstColorBalanceChannel * channel)
       
    60 {
       
    61   if (cb && GST_CAMERABIN (cb)->src_vid_src) {
       
    62     GstColorBalance *cbl = GST_COLOR_BALANCE (GST_CAMERABIN (cb)->src_vid_src);
       
    63     return gst_color_balance_get_value (cbl, channel);
       
    64   } else {
       
    65     return 0;
       
    66   }
       
    67 }
       
    68 
       
    69 /*
       
    70  * extern functions implementation
       
    71  */
       
    72 
       
    73 void
       
    74 gst_camerabin_color_balance_init (GstColorBalanceClass * iface)
       
    75 {
       
    76   /* FIXME: to get the same type as v4l2src */
       
    77   GST_COLOR_BALANCE_TYPE (iface) = GST_COLOR_BALANCE_HARDWARE;
       
    78   iface->list_channels = gst_camerabin_color_balance_list_channels;
       
    79   iface->set_value = gst_camerabin_color_balance_set_value;
       
    80   iface->get_value = gst_camerabin_color_balance_get_value;
       
    81 }