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:mixvideoconfigparamsdec_h264
     11 * @short_description: VideoConfig parameters
     12 *
     13 * A data object which stores videoconfig specific parameters.
     14 */
     15 
     16 #include "mixvideoconfigparamsdec_h264.h"
     17 
     18 static GType _mix_videoconfigparamsdec_h264_type = 0;
     19 static MixVideoConfigParamsDecClass *parent_class = NULL;
     20 
     21 #define _do_init { _mix_videoconfigparamsdec_h264_type = g_define_type_id; }
     22 
     23 gboolean mix_videoconfigparamsdec_h264_copy (MixParams * target,
     24 					  const MixParams * src);
     25 MixParams *mix_videoconfigparamsdec_h264_dup (const MixParams * obj);
     26 gboolean mix_videoconfigparamsdec_h264_equal (MixParams * first,
     27 					   MixParams * second);
     28 static void mix_videoconfigparamsdec_h264_finalize (MixParams * obj);
     29 
     30 G_DEFINE_TYPE_WITH_CODE (MixVideoConfigParamsDecH264,	/* The name of the new type, in Camel case */
     31 			 mix_videoconfigparamsdec_h264,	/* The name of the new type in lowercase */
     32 			 MIX_TYPE_VIDEOCONFIGPARAMSDEC,	/* The GType of the parent type */
     33 			 _do_init);
     34 
     35 void
     36 _mix_videoconfigparamsdec_h264_initialize (void)
     37 {
     38   /* the MixParams types need to be class_ref'd once before it can be
     39    * done from multiple threads;
     40    * see http://bugzilla.gnome.org/show_bug.cgi?id=304551 */
     41   g_type_class_ref (mix_videoconfigparamsdec_h264_get_type ());
     42 }
     43 
     44 static void
     45 mix_videoconfigparamsdec_h264_init (MixVideoConfigParamsDecH264 * self)
     46 {
     47   /* initialize properties here */
     48   /* TODO: initialize properties */
     49   self->reserved1 = NULL;
     50   self->reserved2 = NULL;
     51   self->reserved3 = NULL;
     52   self->reserved4 = NULL;
     53 }
     54 
     55 static void
     56 mix_videoconfigparamsdec_h264_class_init (MixVideoConfigParamsDecH264Class * klass)
     57 {
     58   MixVideoConfigParamsDecClass *this_parent_class =
     59     MIX_VIDEOCONFIGPARAMSDEC_CLASS (klass);
     60   MixParamsClass *this_root_class = MIX_PARAMS_CLASS (this_parent_class);
     61 
     62   /* setup static parent class */
     63   parent_class =
     64     (MixVideoConfigParamsDecClass *) g_type_class_peek_parent (klass);
     65 
     66   this_root_class->finalize = mix_videoconfigparamsdec_h264_finalize;
     67   this_root_class->copy =
     68     (MixParamsCopyFunction) mix_videoconfigparamsdec_h264_copy;
     69   this_root_class->dup =
     70     (MixParamsDupFunction) mix_videoconfigparamsdec_h264_dup;
     71   this_root_class->equal =
     72     (MixParamsEqualFunction) mix_videoconfigparamsdec_h264_equal;
     73 }
     74 
     75 MixVideoConfigParamsDecH264 *
     76 mix_videoconfigparamsdec_h264_new (void)
     77 {
     78   MixVideoConfigParamsDecH264 *ret = (MixVideoConfigParamsDecH264 *)
     79     g_type_create_instance (MIX_TYPE_VIDEOCONFIGPARAMSDEC_H264);
     80 
     81   return ret;
     82 }
     83 
     84 void
     85 mix_videoconfigparamsdec_h264_finalize (MixParams * obj)
     86 {
     87   /* MixVideoConfigParamsDecH264 *this_obj = MIX_VIDEOCONFIGPARAMSDEC_H264 (obj); */
     88   MixParamsClass *root_class = MIX_PARAMS_CLASS (parent_class);
     89 
     90   /* TODO: cleanup resources allocated */
     91 
     92   /* Chain up parent */
     93 
     94   if (root_class->finalize)
     95     {
     96       root_class->finalize (obj);
     97     }
     98 }
     99 
    100 MixVideoConfigParamsDecH264
    101   * mix_videoconfigparamsdec_h264_ref (MixVideoConfigParamsDecH264 * mix)
    102 {
    103   return (MixVideoConfigParamsDecH264 *) mix_params_ref (MIX_PARAMS (mix));
    104 }
    105 
    106 /**
    107 * mix_videoconfigparamsdec_h264_dup:
    108 * @obj: a #MixVideoConfigParamsDec object
    109 * @returns: a newly allocated duplicate of the object.
    110 *
    111 * Copy duplicate of the object.
    112 */
    113 MixParams *
    114 mix_videoconfigparamsdec_h264_dup (const MixParams * obj)
    115 {
    116   MixParams *ret = NULL;
    117 
    118   if (MIX_IS_VIDEOCONFIGPARAMSDEC_H264 (obj))
    119     {
    120       MixVideoConfigParamsDecH264 *duplicate = mix_videoconfigparamsdec_h264_new ();
    121       if (mix_videoconfigparamsdec_h264_copy
    122 	  (MIX_PARAMS (duplicate), MIX_PARAMS (obj)))
    123 	{
    124 	  ret = MIX_PARAMS (duplicate);
    125 	}
    126       else
    127 	{
    128 	  mix_videoconfigparamsdec_h264_unref (duplicate);
    129 	}
    130     }
    131   return ret;
    132 }
    133 
    134 /**
    135 * mix_videoconfigparamsdec_h264_copy:
    136 * @target: copy to target
    137 * @src: copy from src
    138 * @returns: boolean indicates if copy is successful.
    139 *
    140 * Copy instance data from @src to @target.
    141 */
    142 gboolean
    143 mix_videoconfigparamsdec_h264_copy (MixParams * target, const MixParams * src)
    144 {
    145   MixVideoConfigParamsDecH264 *this_target, *this_src;
    146   MixParamsClass *root_class;
    147 
    148   if (MIX_IS_VIDEOCONFIGPARAMSDEC_H264 (target)
    149       && MIX_IS_VIDEOCONFIGPARAMSDEC_H264 (src))
    150     {
    151       // Cast the base object to this child object
    152       this_target = MIX_VIDEOCONFIGPARAMSDEC_H264 (target);
    153       this_src = MIX_VIDEOCONFIGPARAMSDEC_H264 (src);
    154 
    155       // TODO: copy properties */
    156 
    157       // Now chainup base class
    158       root_class = MIX_PARAMS_CLASS (parent_class);
    159 
    160       if (root_class->copy)
    161 	{
    162 	  return root_class->copy (MIX_PARAMS_CAST (target),
    163 				   MIX_PARAMS_CAST (src));
    164 	}
    165       else
    166 	{
    167 	  return TRUE;
    168 	}
    169     }
    170   return FALSE;
    171 }
    172 
    173 /**
    174 * mix_videoconfigparamsdec_h264:
    175 * @first: first object to compare
    176 * @second: seond object to compare
    177 * @returns: boolean indicates if instance are equal.
    178 *
    179 * Copy instance data from @src to @target.
    180 */
    181 gboolean
    182 mix_videoconfigparamsdec_h264_equal (MixParams * first, MixParams * second)
    183 {
    184   gboolean ret = FALSE;
    185   MixVideoConfigParamsDecH264 *this_first, *this_second;
    186 
    187   if (MIX_IS_VIDEOCONFIGPARAMSDEC_H264 (first)
    188       && MIX_IS_VIDEOCONFIGPARAMSDEC_H264 (second))
    189     {
    190       // Cast the base object to this child object
    191 
    192       this_first = MIX_VIDEOCONFIGPARAMSDEC_H264 (first);
    193       this_second = MIX_VIDEOCONFIGPARAMSDEC_H264 (second);
    194 
    195       /* TODO: add comparison for properties */
    196       {
    197 	// members within this scope equal. chaining up.
    198 	MixParamsClass *klass = MIX_PARAMS_CLASS (parent_class);
    199 	if (klass->equal)
    200 	  {
    201 	    ret = klass->equal (first, second);
    202 	  }
    203 	else
    204 	  {
    205 	    ret = TRUE;
    206 	  }
    207       }
    208     }
    209 
    210   return ret;
    211 }
    212 
    213 /* TODO: Add getters and setters for properties if any */
    214