Home | History | Annotate | Download | only in src
      1 /*
      2 INTEL CONFIDENTIAL
      3 Copyright 2009 Intel Corporation All Rights Reserved.
      4 The source code contained or described herein and all documents related to the source code ("Material") are owned by Intel Corporation or its suppliers or licensors. Title to the Material remains with Intel Corporation or its suppliers and licensors. The Material contains trade secrets and proprietary and confidential information of Intel or its suppliers and licensors. The Material is protected by worldwide copyright and trade secret laws and treaty provisions. No part of the Material may be used, copied, reproduced, modified, published, uploaded, posted, transmitted, distributed, or disclosed in any way without Intels prior express written permission.
      5 
      6 No license under any patent, copyright, trade secret or other intellectual property right is granted to or conferred upon you by disclosure or delivery of the Materials, either expressly, by implication, inducement, estoppel or otherwise. Any license under such intellectual property rights must be express and approved by Intel in writing.
      7 */
      8 
      9 /**
     10 * SECTION:mixvideoconfigparamsenc_preview
     11 * @short_description: VideoConfig parameters
     12 *
     13 * A data object which stores videoconfig specific parameters.
     14 */
     15 
     16 #include "mixvideolog.h"
     17 #include "mixvideoconfigparamsenc_preview.h"
     18 
     19 #define MDEBUG
     20 
     21 
     22 static GType _mix_videoconfigparamsenc_preview_type = 0;
     23 static MixVideoConfigParamsEncClass *parent_class = NULL;
     24 
     25 #define _do_init { _mix_videoconfigparamsenc_preview_type = g_define_type_id; }
     26 
     27 gboolean mix_videoconfigparamsenc_preview_copy (MixParams * target,
     28 					  const MixParams * src);
     29 MixParams *mix_videoconfigparamsenc_preview_dup (const MixParams * obj);
     30 gboolean mix_videoconfigparamsencenc_preview_equal (MixParams * first,
     31 					   MixParams * second);
     32 static void mix_videoconfigparamsenc_preview_finalize (MixParams * obj);
     33 
     34 G_DEFINE_TYPE_WITH_CODE (MixVideoConfigParamsEncPreview,	/* The name of the new type, in Camel case */
     35 			 mix_videoconfigparamsenc_preview,	/* The name of the new type in lowercase */
     36 			 MIX_TYPE_VIDEOCONFIGPARAMSENC,	/* The GType of the parent type */
     37 			 _do_init);
     38 
     39 void
     40 _mix_videoconfigparamsenc_preview_initialize (void)
     41 {
     42   /* the MixParams types need to be class_ref'd once before it can be
     43    * done from multiple threads;
     44    * see http://bugzilla.gnome.org/show_bug.cgi?id=304551 */
     45   g_type_class_ref (mix_videoconfigparamsenc_preview_get_type ());
     46 }
     47 
     48 static void
     49 mix_videoconfigparamsenc_preview_init (MixVideoConfigParamsEncPreview * self)
     50 {
     51   /* initialize properties here */
     52   /* TODO: initialize properties */
     53 
     54   self->reserved1 = NULL;
     55   self->reserved2 = NULL;
     56   self->reserved3 = NULL;
     57   self->reserved4 = NULL;
     58 }
     59 
     60 static void
     61 mix_videoconfigparamsenc_preview_class_init (MixVideoConfigParamsEncPreviewClass * klass)
     62 {
     63   MixVideoConfigParamsEncClass *this_parent_class =
     64     MIX_VIDEOCONFIGPARAMSENC_CLASS (klass);
     65   MixParamsClass *this_root_class = MIX_PARAMS_CLASS (this_parent_class);
     66 
     67   /* setup static parent class */
     68   parent_class =
     69     (MixVideoConfigParamsEncClass *) g_type_class_peek_parent (klass);
     70 
     71   this_root_class->finalize = mix_videoconfigparamsenc_preview_finalize;
     72   this_root_class->copy =
     73     (MixParamsCopyFunction) mix_videoconfigparamsenc_preview_copy;
     74   this_root_class->dup =
     75     (MixParamsDupFunction) mix_videoconfigparamsenc_preview_dup;
     76   this_root_class->equal =
     77     (MixParamsEqualFunction) mix_videoconfigparamsencenc_preview_equal;
     78 }
     79 
     80 MixVideoConfigParamsEncPreview *
     81 mix_videoconfigparamsenc_preview_new (void)
     82 {
     83   MixVideoConfigParamsEncPreview *ret = (MixVideoConfigParamsEncPreview *)
     84     g_type_create_instance (MIX_TYPE_VIDEOCONFIGPARAMSENC_PREVIEW);
     85 
     86   return ret;
     87 }
     88 
     89 void
     90 mix_videoconfigparamsenc_preview_finalize (MixParams * obj)
     91 {
     92   /* MixVideoConfigParamsEncPreview *this_obj = MIX_VIDEOCONFIGPARAMSENC_PREVIEW (obj); */
     93   MixParamsClass *root_class = MIX_PARAMS_CLASS (parent_class);
     94 
     95   /* TODO: cleanup resources allocated */
     96 
     97   /* Chain up parent */
     98 
     99   if (root_class->finalize)
    100     {
    101       root_class->finalize (obj);
    102     }
    103 }
    104 
    105 MixVideoConfigParamsEncPreview
    106   * mix_videoconfigparamsenc_preview_ref (MixVideoConfigParamsEncPreview * mix)
    107 {
    108   return (MixVideoConfigParamsEncPreview *) mix_params_ref (MIX_PARAMS (mix));
    109 }
    110 
    111 /**
    112 * mix_videoconfigparamsenc_preview_dup:
    113 * @obj: a #MixVideoConfigParams object
    114 * @returns: a newly allocated duplicate of the object.
    115 *
    116 * Copy duplicate of the object.
    117 */
    118 MixParams *
    119 mix_videoconfigparamsenc_preview_dup (const MixParams * obj)
    120 {
    121   MixParams *ret = NULL;
    122 
    123   if (MIX_IS_VIDEOCONFIGPARAMSENC_PREVIEW (obj))
    124     {
    125       MixVideoConfigParamsEncPreview *duplicate = mix_videoconfigparamsenc_preview_new ();
    126       if (mix_videoconfigparamsenc_preview_copy
    127 	  (MIX_PARAMS (duplicate), MIX_PARAMS (obj)))
    128 	{
    129 	  ret = MIX_PARAMS (duplicate);
    130 	}
    131       else
    132 	{
    133 	  mix_videoconfigparamsenc_preview_unref (duplicate);
    134 	}
    135     }
    136   return ret;
    137 }
    138 
    139 /**
    140 * mix_videoconfigparamsenc_preview_copy:
    141 * @target: copy to target
    142 * @src: copy from src
    143 * @returns: boolean indicates if copy is successful.
    144 *
    145 * Copy instance data from @src to @target.
    146 */
    147 gboolean
    148 mix_videoconfigparamsenc_preview_copy (MixParams * target, const MixParams * src)
    149 {
    150     MixVideoConfigParamsEncPreview *this_target, *this_src;
    151     MixParamsClass *root_class;
    152 
    153     LOG_V( "Begin\n");
    154 
    155     if (MIX_IS_VIDEOCONFIGPARAMSENC_PREVIEW (target)
    156       && MIX_IS_VIDEOCONFIGPARAMSENC_PREVIEW (src))
    157     {
    158       // Cast the base object to this child object
    159       this_target = MIX_VIDEOCONFIGPARAMSENC_PREVIEW (target);
    160       this_src = MIX_VIDEOCONFIGPARAMSENC_PREVIEW (src);
    161 
    162       // Now chainup base class
    163       root_class = MIX_PARAMS_CLASS (parent_class);
    164 
    165       if (root_class->copy)
    166 	{
    167 	  return root_class->copy (MIX_PARAMS_CAST (target),
    168 				   MIX_PARAMS_CAST (src));
    169 	}
    170       else
    171 	{
    172 	  return TRUE;
    173 	}
    174     }
    175   return FALSE;
    176 }
    177 
    178 /**
    179 * mix_videoconfigparamsenc_preview:
    180 * @first: first object to compare
    181 * @second: seond object to compare
    182 * @returns: boolean indicates if instance are equal.
    183 *
    184 * Copy instance data from @src to @target.
    185 */
    186 gboolean
    187 mix_videoconfigparamsencenc_preview_equal (MixParams * first, MixParams * second)
    188 {
    189   gboolean ret = FALSE;
    190   MixVideoConfigParamsEncPreview *this_first, *this_second;
    191 
    192   if (MIX_IS_VIDEOCONFIGPARAMSENC_PREVIEW (first)
    193       && MIX_IS_VIDEOCONFIGPARAMSENC_PREVIEW (second))
    194     {
    195       // Cast the base object to this child object
    196 
    197       this_first = MIX_VIDEOCONFIGPARAMSENC_PREVIEW (first);
    198       this_second = MIX_VIDEOCONFIGPARAMSENC_PREVIEW (second);
    199 
    200 
    201 	ret = TRUE;
    202 
    203 
    204       /* TODO: add comparison for properties */
    205       {
    206 	// members within this scope equal. chaining up.
    207 	MixParamsClass *klass = MIX_PARAMS_CLASS (parent_class);
    208 	if (klass->equal)
    209 	  {
    210 	    ret = klass->equal (first, second);
    211 	  }
    212 	else
    213 	  {
    214 	    ret = TRUE;
    215 	  }
    216       }
    217     }
    218 
    219   return ret;
    220 }
    221 
    222 /* TODO: Add getters and setters for properties if any */
    223