gst_plugins_base/gst-libs/gst/interfaces/mixeroptions.c
changeset 2 5505e8908944
parent 0 0e761a78d257
equal deleted inserted replaced
1:4c282e7dd6d3 2:5505e8908944
       
     1 /* GStreamer Mixer
       
     2  * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
       
     3  *
       
     4  * mixeroptions.c: mixer track options object design
       
     5  *
       
     6  * This library is free software; you can redistribute it and/or
       
     7  * modify it under the terms of the GNU Library General Public
       
     8  * License as published by the Free Software Foundation; either
       
     9  * version 2 of the License, or (at your option) any later version.
       
    10  *
       
    11  * This library is distributed in the hope that it will be useful,
       
    12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       
    14  * Library General Public License for more details.
       
    15  *
       
    16  * You should have received a copy of the GNU Library General Public
       
    17  * License along with this library; if not, write to the
       
    18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
       
    19  * Boston, MA 02111-1307, USA.
       
    20  */
       
    21 
       
    22 #ifdef HAVE_CONFIG_H
       
    23 #include "config.h"
       
    24 #endif
       
    25 
       
    26 #include "mixeroptions.h"
       
    27 
       
    28 #if 0
       
    29 enum
       
    30 {
       
    31   /* FILL ME */
       
    32   SIGNAL_OPTION_CHANGED,
       
    33   LAST_SIGNAL
       
    34 };
       
    35 static guint signals[LAST_SIGNAL] = { 0 };
       
    36 #endif
       
    37 
       
    38 static void gst_mixer_options_class_init (GstMixerOptionsClass * klass);
       
    39 static void gst_mixer_options_init (GstMixerOptions * mixer);
       
    40 static void gst_mixer_options_dispose (GObject * object);
       
    41 
       
    42 static GObjectClass *parent_class = NULL;
       
    43 #ifdef __SYMBIAN32__
       
    44 EXPORT_C
       
    45 #endif
       
    46 
       
    47 
       
    48 GType
       
    49 gst_mixer_options_get_type (void)
       
    50 {
       
    51   static GType gst_mixer_options_type = 0;
       
    52 
       
    53   if (!gst_mixer_options_type) {
       
    54     static const GTypeInfo mixer_options_info = {
       
    55       sizeof (GstMixerOptionsClass),
       
    56       NULL,
       
    57       NULL,
       
    58       (GClassInitFunc) gst_mixer_options_class_init,
       
    59       NULL,
       
    60       NULL,
       
    61       sizeof (GstMixerOptions),
       
    62       0,
       
    63       (GInstanceInitFunc) gst_mixer_options_init,
       
    64       NULL
       
    65     };
       
    66 
       
    67     gst_mixer_options_type =
       
    68         g_type_register_static (GST_TYPE_MIXER_TRACK,
       
    69         "GstMixerOptions", &mixer_options_info, 0);
       
    70   }
       
    71 
       
    72   return gst_mixer_options_type;
       
    73 }
       
    74 
       
    75 static void
       
    76 gst_mixer_options_class_init (GstMixerOptionsClass * klass)
       
    77 {
       
    78   GObjectClass *object_klass = (GObjectClass *) klass;
       
    79 
       
    80   parent_class = g_type_class_peek_parent (klass);
       
    81 #if 0
       
    82   signals[SIGNAL_OPTION_CHANGED] =
       
    83       g_signal_new ("option_changed", G_TYPE_FROM_CLASS (klass),
       
    84       G_SIGNAL_RUN_LAST,
       
    85       G_STRUCT_OFFSET (GstMixerOptionsClass, option_changed),
       
    86       NULL, NULL, g_cclosure_marshal_VOID__STRING,
       
    87       G_TYPE_NONE, 1, G_TYPE_STRING);
       
    88 #endif
       
    89 
       
    90   object_klass->dispose = gst_mixer_options_dispose;
       
    91 }
       
    92 
       
    93 static void
       
    94 gst_mixer_options_init (GstMixerOptions * mixer_options)
       
    95 {
       
    96   mixer_options->values = NULL;
       
    97 }
       
    98 
       
    99 /**
       
   100  * gst_mixer_options_get_values:
       
   101  * @mixer_options: The #GstMixerOptions item that owns the values.
       
   102  *
       
   103  * Get the values for the mixer option.
       
   104  *
       
   105  * Returns: A list of strings with all the possible values for the mixer
       
   106  *     option. You must not free or modify the list or its contents, it belongs
       
   107  *     to the @mixer_options object.
       
   108  */
       
   109 #ifdef __SYMBIAN32__
       
   110 EXPORT_C
       
   111 #endif
       
   112 
       
   113 GList *
       
   114 gst_mixer_options_get_values (GstMixerOptions * mixer_options)
       
   115 {
       
   116   GstMixerOptionsClass *klass;
       
   117   GList *ret = NULL;
       
   118 
       
   119   g_return_val_if_fail (GST_IS_MIXER_OPTIONS (mixer_options), NULL);
       
   120 
       
   121   klass = GST_MIXER_OPTIONS_GET_CLASS (mixer_options);
       
   122 
       
   123   if (klass->get_values != NULL) {
       
   124     ret = klass->get_values (mixer_options);
       
   125   } else {
       
   126     ret = mixer_options->values;
       
   127   }
       
   128 
       
   129   return ret;
       
   130 }
       
   131 
       
   132 
       
   133 static void
       
   134 gst_mixer_options_dispose (GObject * object)
       
   135 {
       
   136   GstMixerOptions *opts = GST_MIXER_OPTIONS (object);
       
   137 
       
   138   g_list_foreach (opts->values, (GFunc) g_free, NULL);
       
   139   g_list_free (opts->values);
       
   140   opts->values = NULL;
       
   141 
       
   142   if (parent_class->dispose)
       
   143     parent_class->dispose (object);
       
   144 }