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