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
     11  * @short_description: VideoConfig parameters
     12  *
     13  * A data object which stores videoconfig specific parameters.
     14  */
     15 
     16 #include <string.h>
     17 #include "mixvideolog.h"
     18 #include "mixvideoconfigparamsenc.h"
     19 
     20 static GType _mix_videoconfigparamsenc_type = 0;
     21 static MixParamsClass *parent_class = NULL;
     22 
     23 #define MDEBUG
     24 
     25 #define _do_init { _mix_videoconfigparamsenc_type = g_define_type_id; }
     26 
     27 gboolean mix_videoconfigparamsenc_copy(MixParams * target, const MixParams * src);
     28 MixParams *mix_videoconfigparamsenc_dup(const MixParams * obj);
     29 gboolean mix_videoconfigparamsenc_equal(MixParams * first, MixParams * second);
     30 static void mix_videoconfigparamsenc_finalize(MixParams * obj);
     31 
     32 G_DEFINE_TYPE_WITH_CODE (MixVideoConfigParamsEnc, mix_videoconfigparamsenc,
     33 		MIX_TYPE_VIDEOCONFIGPARAMS, _do_init);
     34 
     35 static void mix_videoconfigparamsenc_init(MixVideoConfigParamsEnc * self) {
     36     /* initialize properties here */
     37 	self->bitrate = 0;
     38 	self->frame_rate_num = 30;
     39 	self->frame_rate_denom = 1;
     40 	self->initial_qp = 15;
     41 	self->min_qp = 0;
     42 
     43 	self->picture_width = 0;
     44 	self->picture_height = 0;
     45 
     46 	self->mime_type = NULL;
     47 	self->encode_format = 0;
     48 	self->intra_period = 30;
     49 
     50 	self->mixbuffer_pool_size = 0;
     51 
     52 	self->share_buf_mode = FALSE;
     53 
     54 	self->ci_frame_id = NULL;
     55 	self->ci_frame_num = 0;
     56 
     57 	self->need_display = TRUE;
     58 
     59 	self->rate_control = MIX_RATE_CONTROL_NONE;
     60 	self->raw_format = MIX_RAW_TARGET_FORMAT_YUV420;
     61 	self->profile = MIX_PROFILE_H264BASELINE;
     62 
     63 	/* TODO: initialize other properties */
     64 	self->reserved1 = NULL;
     65 	self->reserved2 = NULL;
     66 	self->reserved3 = NULL;
     67 	self->reserved4 = NULL;
     68 }
     69 
     70 static void mix_videoconfigparamsenc_class_init(MixVideoConfigParamsEncClass * klass) {
     71     MixParamsClass *mixparams_class = MIX_PARAMS_CLASS(klass);
     72 
     73     /* setup static parent class */
     74     parent_class = (MixParamsClass *) g_type_class_peek_parent(klass);
     75 
     76     mixparams_class->finalize = mix_videoconfigparamsenc_finalize;
     77     mixparams_class->copy = (MixParamsCopyFunction) mix_videoconfigparamsenc_copy;
     78     mixparams_class->dup = (MixParamsDupFunction) mix_videoconfigparamsenc_dup;
     79     mixparams_class->equal
     80         = (MixParamsEqualFunction) mix_videoconfigparamsenc_equal;
     81 }
     82 
     83 MixVideoConfigParamsEnc *
     84 mix_videoconfigparamsenc_new(void) {
     85     MixVideoConfigParamsEnc *ret =
     86         (MixVideoConfigParamsEnc *) g_type_create_instance(
     87                 MIX_TYPE_VIDEOCONFIGPARAMSENC);
     88 
     89     return ret;
     90 }
     91 
     92 void mix_videoconfigparamsenc_finalize(MixParams * obj) {
     93 
     94 	/* clean up here. */
     95 	MixVideoConfigParamsEnc *self = MIX_VIDEOCONFIGPARAMSENC(obj);
     96 
     97 	/* free mime_type */
     98 	if (self->mime_type->str)
     99 		g_string_free(self->mime_type, TRUE);
    100 	else
    101 		g_string_free(self->mime_type, FALSE);
    102 
    103 	if (self->ci_frame_id)
    104 		g_free (self->ci_frame_id);
    105 
    106 	/* Chain up parent */
    107 	if (parent_class->finalize) {
    108 		parent_class->finalize(obj);
    109 	}
    110 }
    111 
    112 MixVideoConfigParamsEnc *
    113 mix_videoconfigparamsenc_ref(MixVideoConfigParamsEnc * mix) {
    114     return (MixVideoConfigParamsEnc *) mix_params_ref(MIX_PARAMS(mix));
    115 }
    116 
    117 /**
    118  * mix_videoconfigparamsenc_dup:
    119  * @obj: a #MixVideoConfigParamsEnc object
    120  * @returns: a newly allocated duplicate of the object.
    121  *
    122  * Copy duplicate of the object.
    123  */
    124 MixParams *
    125 mix_videoconfigparamsenc_dup(const MixParams * obj) {
    126     MixParams *ret = NULL;
    127 
    128     LOG_V( "Begin\n");
    129 
    130     if (MIX_IS_VIDEOCONFIGPARAMSENC(obj)) {
    131         MixVideoConfigParamsEnc *duplicate = mix_videoconfigparamsenc_new();
    132         if (mix_videoconfigparamsenc_copy(MIX_PARAMS(duplicate), MIX_PARAMS(obj))) {
    133 
    134 			ret = MIX_PARAMS(duplicate);
    135 		} else {
    136 			mix_videoconfigparamsenc_unref(duplicate);
    137 		}
    138 	}
    139 	return ret;
    140 }
    141 
    142 /**
    143  * mix_videoconfigparamsenc_copy:
    144  * @target: copy to target
    145  * @src: copy from src
    146  * @returns: boolean indicates if copy is successful.
    147  *
    148  * Copy instance data from @src to @target.
    149  */
    150 gboolean mix_videoconfigparamsenc_copy(MixParams * target, const MixParams * src) {
    151 
    152 	MixVideoConfigParamsEnc *this_target, *this_src;
    153 	MIX_RESULT mix_result = MIX_RESULT_FAIL;
    154 
    155     LOG_V( "Begin\n");
    156 
    157 	if (MIX_IS_VIDEOCONFIGPARAMSENC(target) && MIX_IS_VIDEOCONFIGPARAMSENC(src)) {
    158 
    159 		/* Cast the base object to this child object */
    160 		this_target = MIX_VIDEOCONFIGPARAMSENC(target);
    161 		this_src = MIX_VIDEOCONFIGPARAMSENC(src);
    162 
    163 		/* copy properties of primitive type */
    164 
    165 		this_target->bitrate   = this_src->bitrate;
    166 		this_target->frame_rate_num = this_src->frame_rate_num;
    167 		this_target->frame_rate_denom = this_src->frame_rate_denom;
    168 		this_target->initial_qp = this_src->initial_qp;
    169 		this_target->min_qp = this_src->min_qp;
    170 		this_target->intra_period    = this_src->intra_period;
    171 		this_target->picture_width    = this_src->picture_width;
    172 		this_target->picture_height   = this_src->picture_height;
    173 		this_target->mixbuffer_pool_size = this_src->mixbuffer_pool_size;
    174 		this_target->share_buf_mode = this_src->share_buf_mode;
    175 		this_target->encode_format = this_src->encode_format;
    176 		this_target->ci_frame_num = this_src->ci_frame_num;
    177 		this_target->draw= this_src->draw;
    178 		this_target->need_display = this_src->need_display;
    179 	       this_target->rate_control = this_src->rate_control;
    180 	       this_target->raw_format = this_src->raw_format;
    181 	       this_target->profile = this_src->profile;
    182 
    183 		/* copy properties of non-primitive */
    184 
    185 		/* copy mime_type */
    186 
    187 		if (this_src->mime_type) {
    188 #ifdef MDEBUG
    189             if (this_src->mime_type->str) {
    190 
    191                 LOG_I( "this_src->mime_type->str = %s  %x\n",
    192                         this_src->mime_type->str, (unsigned int)this_src->mime_type->str);
    193             }
    194 #endif
    195 
    196             mix_result = mix_videoconfigparamsenc_set_mime_type(this_target,
    197                     this_src->mime_type->str);
    198         } else {
    199 
    200             LOG_I( "this_src->mime_type = NULL\n");
    201 
    202             mix_result = mix_videoconfigparamsenc_set_mime_type(this_target, NULL);
    203         }
    204 
    205         if (mix_result != MIX_RESULT_SUCCESS) {
    206 
    207             LOG_E( "Failed to mix_videoconfigparamsenc_set_mime_type\n");
    208             return FALSE;
    209         }
    210 
    211         mix_result = mix_videoconfigparamsenc_set_ci_frame_info (this_target, this_src->ci_frame_id,
    212                 this_src->ci_frame_num);
    213 
    214         /* TODO: copy other properties if there's any */
    215 
    216 		/* Now chainup base class */
    217 		if (parent_class->copy) {
    218             return parent_class->copy(MIX_PARAMS_CAST(target), MIX_PARAMS_CAST(
    219                         src));
    220         } else {
    221             return TRUE;
    222         }
    223     }
    224 
    225     return FALSE;
    226 }
    227 
    228 
    229 /**
    230  * mix_videoconfigparamsenc_:
    231  * @first: first object to compare
    232  * @second: seond object to compare
    233  * @returns: boolean indicates if instance are equal.
    234  *
    235  * Copy instance data from @src to @target.
    236  */
    237 gboolean mix_videoconfigparamsenc_equal(MixParams * first, MixParams * second) {
    238 
    239 	gboolean ret = FALSE;
    240 
    241 	MixVideoConfigParamsEnc *this_first, *this_second;
    242 
    243 	if (MIX_IS_VIDEOCONFIGPARAMSENC(first) && MIX_IS_VIDEOCONFIGPARAMSENC(second)) {
    244 
    245 		// Deep compare
    246 		// Cast the base object to this child object
    247 		this_first = MIX_VIDEOCONFIGPARAMSENC(first);
    248 		this_second = MIX_VIDEOCONFIGPARAMSENC(second);
    249 
    250 		/* check the equalitiy of the primitive type properties */
    251 		if (this_first->bitrate != this_second->bitrate) {
    252 			goto not_equal;
    253 		}
    254 
    255 		if (this_first->frame_rate_num != this_second->frame_rate_num) {
    256 			goto not_equal;
    257 		}
    258 
    259 		if (this_first->frame_rate_denom != this_second->frame_rate_denom) {
    260 			goto not_equal;
    261 		}
    262 
    263 		if (this_first->initial_qp != this_second->initial_qp) {
    264 			goto not_equal;
    265 		}
    266 
    267 		if (this_first->min_qp != this_second->min_qp) {
    268 			goto not_equal;
    269 		}
    270 
    271 		if (this_first->intra_period != this_second->intra_period) {
    272 			goto not_equal;
    273 		}
    274 
    275 		if (this_first->picture_width != this_second->picture_width
    276 				&& this_first->picture_height != this_second->picture_height) {
    277 			goto not_equal;
    278 		}
    279 
    280 		if (this_first->encode_format != this_second->encode_format) {
    281 			goto not_equal;
    282 		}
    283 
    284 		if (this_first->mixbuffer_pool_size != this_second->mixbuffer_pool_size) {
    285 			goto not_equal;
    286 		}
    287 
    288 		if (this_first->share_buf_mode != this_second->share_buf_mode) {
    289 			goto not_equal;
    290 		}
    291 
    292 		if (this_first->ci_frame_id != this_second->ci_frame_id) {
    293 			goto not_equal;
    294 		}
    295 
    296 		if (this_first->ci_frame_num != this_second->ci_frame_num) {
    297 			goto not_equal;
    298 		}
    299 
    300 		if (this_first->draw != this_second->draw) {
    301 			goto not_equal;
    302 		}
    303 
    304 		if (this_first->need_display!= this_second->need_display) {
    305 			goto not_equal;
    306 		}
    307 
    308 	      if (this_first->rate_control != this_second->rate_control) {
    309 		  	goto not_equal;
    310 		}
    311 
    312 	      if (this_first->raw_format != this_second->raw_format) {
    313 		  	goto not_equal;
    314 		}
    315 
    316 	      if (this_first->profile != this_second->profile) {
    317 		  	goto not_equal;
    318 		}
    319 
    320 		/* check the equalitiy of the none-primitive type properties */
    321 
    322 		/* compare mime_type */
    323 
    324 		if (this_first->mime_type && this_second->mime_type) {
    325 			if (g_string_equal(this_first->mime_type, this_second->mime_type)
    326 					!= TRUE) {
    327 				goto not_equal;
    328 			}
    329 		} else if (!(!this_first->mime_type && !this_second->mime_type)) {
    330 			goto not_equal;
    331 		}
    332 
    333 		ret = TRUE;
    334 
    335 		not_equal:
    336 
    337 		if (ret != TRUE) {
    338 			return ret;
    339 		}
    340 
    341 		/* chaining up. */
    342 		MixParamsClass *klass = MIX_PARAMS_CLASS(parent_class);
    343 		if (klass->equal)
    344 			ret = parent_class->equal(first, second);
    345 		else
    346 			ret = TRUE;
    347 	}
    348 
    349 	return ret;
    350 }
    351 
    352 #define MIX_VIDEOCONFIGPARAMSENC_SETTER_CHECK_INPUT(obj) \
    353 	if(!obj) return MIX_RESULT_NULL_PTR; \
    354 	if(!MIX_IS_VIDEOCONFIGPARAMSENC(obj)) return MIX_RESULT_FAIL; \
    355 
    356 #define MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT(obj, prop) \
    357 	if(!obj || !prop) return MIX_RESULT_NULL_PTR; \
    358 	if(!MIX_IS_VIDEOCONFIGPARAMSENC(obj)) return MIX_RESULT_FAIL; \
    359 
    360 #define MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT_PAIR(obj, prop, prop2) \
    361 	if(!obj || !prop || !prop2 ) return MIX_RESULT_NULL_PTR; \
    362 	if(!MIX_IS_VIDEOCONFIGPARAMSENC(obj)) return MIX_RESULT_FAIL; \
    363 
    364 /* TODO: Add getters and setters for other properties. The following is incomplete */
    365 
    366 
    367 MIX_RESULT mix_videoconfigparamsenc_set_mime_type(MixVideoConfigParamsEnc * obj,
    368 		const gchar * mime_type) {
    369 
    370 	MIX_VIDEOCONFIGPARAMSENC_SETTER_CHECK_INPUT (obj);
    371 
    372 	if (!mime_type) {
    373 		return MIX_RESULT_NULL_PTR;
    374 	}
    375 
    376 	LOG_I( "mime_type = %s  %x\n",
    377 		mime_type, (unsigned int)mime_type);
    378 
    379 	if (obj->mime_type) {
    380 		if (obj->mime_type->str)
    381 			g_string_free(obj->mime_type, TRUE);
    382 		else
    383 			g_string_free(obj->mime_type, FALSE);
    384 	}
    385 
    386 
    387 	LOG_I( "mime_type = %s  %x\n",
    388 		mime_type, (unsigned int)mime_type);
    389 
    390 	obj->mime_type = g_string_new(mime_type);
    391 	if (!obj->mime_type) {
    392 		return MIX_RESULT_NO_MEMORY;
    393 	}
    394 
    395 
    396 	LOG_I( "mime_type = %s obj->mime_type->str = %s\n",
    397 			mime_type, obj->mime_type->str);
    398 
    399 	return MIX_RESULT_SUCCESS;
    400 }
    401 
    402 MIX_RESULT mix_videoconfigparamsenc_get_mime_type(MixVideoConfigParamsEnc * obj,
    403 		gchar ** mime_type) {
    404 	MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT (obj, mime_type);
    405 
    406 	if (!obj->mime_type) {
    407 		*mime_type = NULL;
    408 		return MIX_RESULT_SUCCESS;
    409 	}
    410 	*mime_type = g_strdup(obj->mime_type->str);
    411 	if (!*mime_type) {
    412 		return MIX_RESULT_NO_MEMORY;
    413 	}
    414 
    415 	return MIX_RESULT_SUCCESS;
    416 }
    417 
    418 MIX_RESULT mix_videoconfigparamsenc_set_frame_rate(MixVideoConfigParamsEnc * obj,
    419 		guint frame_rate_num, guint frame_rate_denom) {
    420 	MIX_VIDEOCONFIGPARAMSENC_SETTER_CHECK_INPUT (obj);
    421 	obj->frame_rate_num = frame_rate_num;
    422 	obj->frame_rate_denom = frame_rate_denom;
    423 	return MIX_RESULT_SUCCESS;
    424 }
    425 
    426 MIX_RESULT mix_videoconfigparamsenc_get_frame_rate(MixVideoConfigParamsEnc * obj,
    427 		guint * frame_rate_num, guint * frame_rate_denom) {
    428 	MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT_PAIR (obj, frame_rate_num, frame_rate_denom);
    429 	*frame_rate_num = obj->frame_rate_num;
    430 	*frame_rate_denom = obj->frame_rate_denom;
    431 	return MIX_RESULT_SUCCESS;
    432 }
    433 
    434 MIX_RESULT mix_videoconfigparamsenc_set_picture_res(MixVideoConfigParamsEnc * obj,
    435 		guint picture_width, guint picture_height) {
    436 	MIX_VIDEOCONFIGPARAMSENC_SETTER_CHECK_INPUT (obj);
    437 	obj->picture_width = picture_width;
    438 	obj->picture_height = picture_height;
    439 	return MIX_RESULT_SUCCESS;
    440 }
    441 
    442 MIX_RESULT mix_videoconfigparamsenc_get_picture_res(MixVideoConfigParamsEnc * obj,
    443         guint * picture_width, guint * picture_height) {
    444 	MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT_PAIR (obj, picture_width, picture_height);
    445 	*picture_width = obj->picture_width;
    446 	*picture_height = obj->picture_height;
    447 	return MIX_RESULT_SUCCESS;
    448 }
    449 
    450 MIX_RESULT mix_videoconfigparamsenc_set_encode_format(MixVideoConfigParamsEnc * obj,
    451 		MixEncodeTargetFormat encode_format) {
    452 	MIX_VIDEOCONFIGPARAMSENC_SETTER_CHECK_INPUT (obj);
    453 	obj->encode_format = encode_format;
    454 	return MIX_RESULT_SUCCESS;
    455 }
    456 
    457 MIX_RESULT mix_videoconfigparamsenc_get_encode_format (MixVideoConfigParamsEnc * obj,
    458 		MixEncodeTargetFormat* encode_format) {
    459 	MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT (obj, encode_format);
    460        *encode_format = obj->encode_format;
    461 	return MIX_RESULT_SUCCESS;
    462 }
    463 
    464 MIX_RESULT mix_videoconfigparamsenc_set_bit_rate (MixVideoConfigParamsEnc * obj,
    465         guint bitrate) {
    466 	MIX_VIDEOCONFIGPARAMSENC_SETTER_CHECK_INPUT (obj);
    467 	obj->bitrate= bitrate;
    468 	return MIX_RESULT_SUCCESS;
    469 
    470 }
    471 
    472 MIX_RESULT mix_videoconfigparamsenc_get_bit_rate (MixVideoConfigParamsEnc * obj,
    473         guint *bitrate) {
    474 	MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT (obj, bitrate);
    475 	*bitrate = obj->bitrate;
    476 	return MIX_RESULT_SUCCESS;
    477 }
    478 
    479 MIX_RESULT mix_videoconfigparamsenc_set_init_qp (MixVideoConfigParamsEnc * obj,
    480         guint initial_qp) {
    481 	MIX_VIDEOCONFIGPARAMSENC_SETTER_CHECK_INPUT (obj);
    482 	obj->initial_qp = initial_qp;
    483 	return MIX_RESULT_SUCCESS;
    484 }
    485 
    486 MIX_RESULT mix_videoconfigparamsenc_get_init_qp (MixVideoConfigParamsEnc * obj,
    487         guint *initial_qp) {
    488 	MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT (obj, initial_qp);
    489 	*initial_qp = obj->initial_qp;
    490 	return MIX_RESULT_SUCCESS;
    491 
    492 }
    493 
    494 MIX_RESULT mix_videoconfigparamsenc_set_min_qp (MixVideoConfigParamsEnc * obj,
    495         guint min_qp) {
    496 	MIX_VIDEOCONFIGPARAMSENC_SETTER_CHECK_INPUT (obj);
    497 	obj->min_qp = min_qp;
    498 	return MIX_RESULT_SUCCESS;
    499 }
    500 
    501 MIX_RESULT mix_videoconfigparamsenc_get_min_qp(MixVideoConfigParamsEnc * obj,
    502         guint *min_qp) {
    503     MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT (obj, min_qp);
    504     *min_qp = obj->min_qp;
    505 
    506     return MIX_RESULT_SUCCESS;
    507 }
    508 
    509 MIX_RESULT mix_videoconfigparamsenc_set_intra_period (MixVideoConfigParamsEnc * obj,
    510         guint intra_period) {
    511 	MIX_VIDEOCONFIGPARAMSENC_SETTER_CHECK_INPUT (obj);
    512 	obj->intra_period = intra_period;
    513 
    514 	return MIX_RESULT_SUCCESS;
    515 }
    516 
    517 MIX_RESULT mix_videoconfigparamsenc_get_intra_period (MixVideoConfigParamsEnc * obj,
    518         guint *intra_period) {
    519 	MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT (obj, intra_period);
    520 	*intra_period = obj->intra_period;
    521 
    522 	return MIX_RESULT_SUCCESS;
    523 }
    524 
    525 MIX_RESULT mix_videoconfigparamsenc_set_buffer_pool_size(
    526 		MixVideoConfigParamsEnc * obj, guint bufpoolsize) {
    527 
    528 	MIX_VIDEOCONFIGPARAMSENC_SETTER_CHECK_INPUT (obj);
    529 
    530 	obj->mixbuffer_pool_size = bufpoolsize;
    531 	return MIX_RESULT_SUCCESS;
    532 
    533 }
    534 
    535 MIX_RESULT mix_videoconfigparamsenc_get_buffer_pool_size(
    536 		MixVideoConfigParamsEnc * obj, guint *bufpoolsize) {
    537 
    538 	MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT (obj, bufpoolsize);
    539 	*bufpoolsize = obj->mixbuffer_pool_size;
    540 	return MIX_RESULT_SUCCESS;
    541 }
    542 
    543 MIX_RESULT mix_videoconfigparamsenc_set_share_buf_mode (
    544 	MixVideoConfigParamsEnc * obj, gboolean share_buf_mod) {
    545 	MIX_VIDEOCONFIGPARAMSENC_SETTER_CHECK_INPUT (obj);
    546 
    547 	obj->share_buf_mode = share_buf_mod;
    548 	return MIX_RESULT_SUCCESS;
    549 }
    550 
    551 MIX_RESULT mix_videoconfigparamsenc_get_share_buf_mode(MixVideoConfigParamsEnc * obj,
    552 		gboolean *share_buf_mod) {
    553 	MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT (obj, share_buf_mod);
    554 
    555 	*share_buf_mod = obj->share_buf_mode;
    556 	return MIX_RESULT_SUCCESS;
    557 }
    558 
    559 MIX_RESULT mix_videoconfigparamsenc_set_ci_frame_info(MixVideoConfigParamsEnc * obj,
    560         gulong * ci_frame_id, guint ci_frame_num) {
    561 	MIX_VIDEOCONFIGPARAMSENC_SETTER_CHECK_INPUT (obj);
    562 
    563 
    564 	if (!ci_frame_id || !ci_frame_num) {
    565 		obj->ci_frame_id = NULL;
    566 		obj->ci_frame_num = 0;
    567 		return MIX_RESULT_SUCCESS;
    568 	}
    569 
    570 	if (obj->ci_frame_id)
    571 		g_free (obj->ci_frame_id);
    572 
    573 	guint size = ci_frame_num * sizeof (gulong);
    574 	obj->ci_frame_num = ci_frame_num;
    575 
    576 	obj->ci_frame_id = g_malloc (ci_frame_num * sizeof (gulong));
    577 	if (!(obj->ci_frame_id)) {
    578 		return MIX_RESULT_NO_MEMORY;
    579 	}
    580 
    581 	memcpy (obj->ci_frame_id, ci_frame_id, size);
    582 
    583 	return MIX_RESULT_SUCCESS;
    584 }
    585 
    586 MIX_RESULT mix_videoconfigparamsenc_get_ci_frame_info (MixVideoConfigParamsEnc * obj,
    587         gulong * *ci_frame_id, guint *ci_frame_num) {
    588     MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT_PAIR (obj, ci_frame_id, ci_frame_num);
    589 
    590 	*ci_frame_num = obj->ci_frame_num;
    591 
    592 	if (!obj->ci_frame_id) {
    593 		*ci_frame_id = NULL;
    594 		return MIX_RESULT_SUCCESS;
    595 	}
    596 
    597 	if (obj->ci_frame_num) {
    598 		*ci_frame_id = g_malloc (obj->ci_frame_num * sizeof (gulong));
    599 
    600 		if (!*ci_frame_id) {
    601 			return MIX_RESULT_NO_MEMORY;
    602 		}
    603 
    604 		memcpy (*ci_frame_id, obj->ci_frame_id, obj->ci_frame_num * sizeof (gulong));
    605 
    606 	} else {
    607 		*ci_frame_id = NULL;
    608 	}
    609 
    610 	return MIX_RESULT_SUCCESS;
    611 }
    612 
    613 
    614 MIX_RESULT mix_videoconfigparamsenc_set_drawable (MixVideoConfigParamsEnc * obj,
    615         gulong draw) {
    616 
    617 	MIX_VIDEOCONFIGPARAMSENC_SETTER_CHECK_INPUT (obj);
    618 	obj->draw = draw;
    619 	return MIX_RESULT_SUCCESS;
    620 
    621 }
    622 
    623 MIX_RESULT mix_videoconfigparamsenc_get_drawable (MixVideoConfigParamsEnc * obj,
    624         gulong *draw) {
    625 
    626 	MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT (obj, draw);
    627 	*draw = obj->draw;
    628 	return MIX_RESULT_SUCCESS;
    629 }
    630 
    631 MIX_RESULT mix_videoconfigparamsenc_set_need_display (
    632 	MixVideoConfigParamsEnc * obj, gboolean need_display) {
    633 	MIX_VIDEOCONFIGPARAMSENC_SETTER_CHECK_INPUT (obj);
    634 
    635 	obj->need_display = need_display;
    636 	return MIX_RESULT_SUCCESS;
    637 }
    638 
    639 MIX_RESULT mix_videoconfigparamsenc_get_need_display(MixVideoConfigParamsEnc * obj,
    640 		gboolean *need_display) {
    641 	MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT (obj, need_display);
    642 
    643 	*need_display = obj->need_display;
    644 	return MIX_RESULT_SUCCESS;
    645 }
    646 
    647 MIX_RESULT mix_videoconfigparamsenc_set_rate_control(MixVideoConfigParamsEnc * obj,
    648 		MixRateControl rate_control) {
    649 	MIX_VIDEOCONFIGPARAMSENC_SETTER_CHECK_INPUT (obj);
    650 	obj->rate_control = rate_control;
    651 	return MIX_RESULT_SUCCESS;
    652 }
    653 
    654 MIX_RESULT mix_videoconfigparamsenc_get_rate_control(MixVideoConfigParamsEnc * obj,
    655 		MixRateControl * rate_control) {
    656 	MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT (obj, rate_control);
    657 	*rate_control = obj->rate_control;
    658 	return MIX_RESULT_SUCCESS;
    659 }
    660 
    661 MIX_RESULT mix_videoconfigparamsenc_set_raw_format (MixVideoConfigParamsEnc * obj,
    662 		MixRawTargetFormat raw_format) {
    663 	MIX_VIDEOCONFIGPARAMSENC_SETTER_CHECK_INPUT (obj);
    664 	obj->raw_format = raw_format;
    665 	return MIX_RESULT_SUCCESS;
    666 }
    667 
    668 MIX_RESULT mix_videoconfigparamsenc_get_raw_format (MixVideoConfigParamsEnc * obj,
    669 		MixRawTargetFormat * raw_format) {
    670 	MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT (obj, raw_format);
    671 	*raw_format = obj->raw_format;
    672 	return MIX_RESULT_SUCCESS;
    673 }
    674 
    675 MIX_RESULT mix_videoconfigparamsenc_set_profile (MixVideoConfigParamsEnc * obj,
    676 		MixProfile profile) {
    677 	MIX_VIDEOCONFIGPARAMSENC_SETTER_CHECK_INPUT (obj);
    678 	obj->profile = profile;
    679 	return MIX_RESULT_SUCCESS;
    680 }
    681 
    682 MIX_RESULT mix_videoconfigparamsenc_get_profile (MixVideoConfigParamsEnc * obj,
    683 		MixProfile * profile) {
    684 	MIX_VIDEOCONFIGPARAMSENC_GETTER_CHECK_INPUT (obj, profile);
    685 	*profile = obj->profile;
    686 	return MIX_RESULT_SUCCESS;
    687 }
    688 
    689