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 Intel’s 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 #ifndef __MIX_AUDIOCONFIGPARAMS_H__ 10 #define __MIX_AUDIOCONFIGPARAMS_H__ 11 12 13 #include "mixparams.h" 14 #include "mixresult.h" 15 #include "mixaudiotypes.h" 16 17 /** 18 * MixACPOpAlign: 19 * @MIX_ACP_OUTPUT_ALIGN_UNKNOWN: Output alignment undefined. 20 * @IX_ACP_OUTPUT_ALIGN_16: Output word is 16-bit aligned 21 * @MIX_ACP_OUTPUT_ALIGN_MSB: Output word is MSB aligned 22 * @MIX_ACP_OUTPUT_ALIGN_LSB: Output word is LSB aligned 23 * @MIX_ACP_OUTPUT_ALIGN_LAST: Last entry in list. 24 * 25 * Audio Output alignment. 26 * 27 */ 28 typedef enum { 29 MIX_ACP_OUTPUT_ALIGN_UNKNOWN=-1, 30 MIX_ACP_OUTPUT_ALIGN_16=0, 31 MIX_ACP_OUTPUT_ALIGN_MSB, 32 MIX_ACP_OUTPUT_ALIGN_LSB, 33 MIX_ACP_OUTPUT_ALIGN_LAST 34 } MixACPOpAlign; 35 36 /** 37 * MixACPBPSType: 38 * @MIX_ACP_BPS_UNKNOWN: Bit Per Sample undefined. 39 * @MIX_ACP_BPS_16: Output bits per sample is 16 bits 40 * @MIX_ACP_BPS_24: Output bits per sample is 24 bits 41 * 42 * Audio Output Size in bits per sample. 43 * 44 */ 45 typedef enum { 46 MIX_ACP_BPS_UNKNOWN=0, 47 MIX_ACP_BPS_16=16, 48 MIX_ACP_BPS_24=24, 49 } MixACPBPSType; 50 51 /** 52 * MIX_TYPE_AUDIOCONFIGPARAMS: 53 * 54 * Get type of class. 55 */ 56 #define MIX_TYPE_AUDIOCONFIGPARAMS (mix_acp_get_type ()) 57 58 /** 59 * MIX_AUDIOCONFIGPARAMS: 60 * @obj: object to be type-casted. 61 * 62 * Type casting. 63 */ 64 #define MIX_AUDIOCONFIGPARAMS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIX_TYPE_AUDIOCONFIGPARAMS, MixAudioConfigParams)) 65 66 /** 67 * MIX_IS_AUDIOCONFIGPARAMS: 68 * @obj: an object. 69 * 70 * Checks if the given object is an instance of #MixAudioConfigParams 71 */ 72 #define MIX_IS_AUDIOCONFIGPARAMS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIX_TYPE_AUDIOCONFIGPARAMS)) 73 74 /** 75 * MIX_AUDIOCONFIGPARAMS_CLASS: 76 * @klass: class to be type-casted. 77 * 78 * Type casting. 79 */ 80 #define MIX_AUDIOCONFIGPARAMS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MIX_TYPE_AUDIOCONFIGPARAMS, MixAudioConfigParamsClass)) 81 82 /** 83 * MIX_IS_AUDIOCONFIGPARAMS_CLASS: 84 * @klass: a class. 85 * 86 * Checks if the given class is #MixAudioConfigParamsClass 87 */ 88 #define MIX_IS_AUDIOCONFIGPARAMS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MIX_TYPE_AUDIOCONFIGPARAMS)) 89 90 /** 91 * MIX_AUDIOCONFIGPARAMS_GET_CLASS: 92 * @obj: a #MixParams object. 93 * 94 * Get the class instance of the object. 95 */ 96 #define MIX_AUDIOCONFIGPARAMS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MIX_TYPE_AUDIOCONFIGPARAMS, MixAudioConfigParamsClass)) 97 98 typedef struct _MixAudioConfigParams MixAudioConfigParams; 99 typedef struct _MixAudioConfigParamsClass MixAudioConfigParamsClass; 100 101 /** 102 * MixDecodeMode: 103 * @MIX_DECODE_NULL: Undefined decode mode. 104 * @MIX_DECODE_DIRECTRENDER: Stream is configured in Direct Render mode 105 * @MIX_DECODE_DECODERETURN: Stream is configured in Decode Return mode 106 * @MIX_DECODE_LAST: Last index in the enumeration. 107 * 108 * Operation Mode for a MI-X session. See mix_audio_configure(). 109 * 110 */ 111 typedef enum { 112 MIX_DECODE_NULL=0, 113 MIX_DECODE_DIRECTRENDER, 114 MIX_DECODE_DECODERETURN, 115 MIX_DECODE_LAST 116 } MixDecodeMode; 117 118 /** 119 * MixAudioConfigParams: 120 * @parent: parent. 121 * @decode_mode: Decode Mode to use for current session. See #mix_acp_set_decodemode 122 * @stream_name: Stream name. See #mix_acp_set_streamname. This object will release the string upon destruction. 123 * @audio_manager: Type of Audio Manager. See #mix_acp_set_audio_manager. 124 * @num_channels: Number of output channels. See #MIX_ACP_NUM_CHANNELS 125 * @bit_rate: <emphasis>Optional.</emphasis> See #MIX_ACP_BITRATE 126 * @sample_freq: Output frequency. See #MIX_ACP_SAMPLE_FREQ 127 * @bits_per_sample: Number of output bit per sample. See #mix_acp_set_bps 128 * @op_align: Output Byte Alignment. See #mix_acp_set_op_align 129 * 130 * @MixAudio configuration parameters object. 131 */ 132 struct _MixAudioConfigParams 133 { 134 /*< public >*/ 135 MixParams parent; 136 137 /*< public >*/ 138 /* Audio Session Parameters */ 139 MixDecodeMode decode_mode; 140 gchar *stream_name; 141 MixAudioManager audio_manager; 142 143 /*< public >*/ 144 /* Audio Format Parameters */ 145 gint num_channels; 146 gint bit_rate; 147 gint sample_freq; 148 MixACPBPSType bits_per_sample; 149 MixACPOpAlign op_align; 150 /*< private >*/ 151 void* reserved1; 152 void* reserved2; 153 void* reserved3; 154 void* reserved4; 155 }; 156 157 /** 158 * MixAudioConfigParamsClass: 159 * 160 * MI-X Audio object class 161 */ 162 struct _MixAudioConfigParamsClass 163 { 164 /*< public >*/ 165 MixParamsClass parent_class; 166 167 /*< virtual public >*/ 168 void (*print_params) (MixAudioConfigParams *obj); 169 170 /* class members */ 171 172 }; 173 174 /** 175 * mix_acp_get_type: 176 * @returns: type 177 * 178 * Get the type of object. 179 */ 180 GType mix_acp_get_type (void); 181 182 /** 183 * mix_acp_new: 184 * @returns: A newly allocated instance of #MixAudioConfigParams 185 * 186 * Use this method to create new instance of #MixAudioConfigParams 187 */ 188 MixAudioConfigParams *mix_acp_new(void); 189 190 /** 191 * mix_acp_ref: 192 * @mix: object to add reference 193 * @returns: the MixAudioConfigParams instance where reference count has been increased. 194 * 195 * Add reference count. 196 */ 197 MixAudioConfigParams *mix_acp_ref(MixAudioConfigParams *mix); 198 199 /** 200 * mix_acp_unref: 201 * @obj: object to unref. 202 * 203 * Decrement reference count of the object. 204 */ 205 #define mix_acp_unref(obj) mix_params_unref(MIX_PARAMS(obj)) 206 207 /* Class Methods */ 208 209 /** 210 * MIX_ACP_DECODEMODE: 211 * @obj: #MixAudioConfigParams object 212 * 213 * MixAudioConfigParam.decode_mode accessor. 214 * 215 * Configure the decode mode to one of #MixDecodeMode value. 216 */ 217 #define MIX_ACP_DECODEMODE(obj) (MIX_AUDIOCONFIGPARAMS(obj)->decode_mode) 218 219 /** 220 * MIX_ACP_NUM_CHANNELS: 221 * @obj: #MixAudioConfigParams object 222 * 223 * MixAudioConfigParam.num_channels accessor. 224 * 225 * Configure the number of output channels. This value need to be exact the same as the supported output channel in the audio since down-mixing is not supported. 226 * 227 * This value can be used during #MIX_DECODE_DECODERETURN mode for buffer size/duration calculation. 228 * 229 * In Moorestown, number of channel must be 1 or 2. 230 */ 231 #define MIX_ACP_NUM_CHANNELS(obj) (MIX_AUDIOCONFIGPARAMS(obj)->num_channels) 232 233 /** 234 * MIX_ACP_BITRATE: 235 * @obj: #MixAudioConfigParams object 236 * 237 * MixAudioConfigParam.bit_rate accessor. 238 * 239 * Bit rate of the current audio. 240 * 241 * <remark>Optional</remark> 242 */ 243 #define MIX_ACP_BITRATE(obj) (MIX_AUDIOCONFIGPARAMS(obj)->bit_rate) 244 245 /** 246 * MIX_ACP_SAMPLE_FREQ: 247 * @obj: #MixAudioConfigParams object 248 * 249 * MixAudioConfigParam.sample_freq accessor. 250 * 251 * Output sampling frequency. 252 * 253 * This value can be used during #MIX_DECODE_DECODERETURN mode for buffer size/duration calculation. 254 */ 255 #define MIX_ACP_SAMPLE_FREQ(obj) (MIX_AUDIOCONFIGPARAMS(obj)->sample_freq) 256 257 /** 258 * mix_acp_get_decodemode: 259 * @obj: #MixAudioConfigParams 260 * @returns: #MixDecodeMode 261 * 262 * Retrieve currently configured #MixDecodeMode. 263 */ 264 MixDecodeMode mix_acp_get_decodemode(MixAudioConfigParams *obj); 265 266 /** 267 * mix_acp_set_decodemode: 268 * @obj: #MixAudioConfigParams 269 * @mode: #MixDecodeMode to set 270 * @returns: #MIX_RESULT 271 * 272 * Configure session for one of the #MixDecodeMode. 273 */ 274 MIX_RESULT mix_acp_set_decodemode(MixAudioConfigParams *obj, MixDecodeMode mode); 275 276 /** 277 * mix_acp_get_streamname: 278 * @obj: #MixAudioConfigParams 279 * @returns: pointer to a copy of the stream name. NULL if name is not available. 280 * 281 * Return copy of streamname. caller must free with g_free() 282 */ 283 gchar *mix_acp_get_streamname(MixAudioConfigParams *obj); 284 285 /** 286 * mix_acp_set_streamname: 287 * @obj: #MixAudioConfigParams 288 * @streamname: Stream name to set 289 * @returns: #MIX_RESULT 290 * 291 * Set the stream name. The object will make a copy of the input stream name string. 292 * 293 */ 294 MIX_RESULT mix_acp_set_streamname(MixAudioConfigParams *obj, const gchar *streamname); 295 296 /** 297 * mix_acp_set_audio_manager: 298 * @obj: #MixAudioConfigParams 299 * @am: #MixAudioManager 300 * @returns: #MIX_RESULT 301 * 302 * Set the Audio Manager to one of the #MixAudioManager. 303 */ 304 MIX_RESULT mix_acp_set_audio_manager(MixAudioConfigParams *obj, MixAudioManager am); 305 306 /** 307 * mix_acp_get_audio_manager: 308 * @obj: #MixAudioConfigParams 309 * @returns: #MixAudioManager 310 * 311 * Retrieve name of currently configured audio manager. 312 */ 313 MixAudioManager mix_acp_get_audio_manager(MixAudioConfigParams *obj); 314 315 /** 316 * mix_acp_is_streamname_valid: 317 * @obj: #MixAudioConfigParams 318 * @returns: boolean indicates if stream name is valid. 319 * 320 * Check if stream name is valid considering the current Decode Mode. 321 */ 322 gboolean mix_acp_is_streamname_valid(MixAudioConfigParams *obj); 323 324 325 /** 326 * mix_acp_get_bps: 327 * @obj: #MixAudioConfigParams 328 * @returns: #MixACPBPSType 329 * 330 * Retrive currently configured bit-per-stream value. 331 */ 332 MixACPBPSType mix_acp_get_bps(MixAudioConfigParams *obj); 333 334 /** 335 * mix_acp_set_bps: 336 * @obj: #MixAudioConfigParams 337 * @mode: #MixACPBPSType to set 338 * @returns: #MIX_RESULT 339 * 340 * Configure bit-per-stream of one of the supported #MixACPBPSType. 341 */ 342 MIX_RESULT mix_acp_set_bps(MixAudioConfigParams *obj, MixACPBPSType type); 343 344 /** 345 * mix_acp_get_op_align: 346 * @obj: #MixAudioConfigParams object 347 * @returns: #MixACPOpAlign 348 * 349 * Get Output Alignment. 350 */ 351 MixACPOpAlign mix_acp_get_op_align(MixAudioConfigParams *obj); 352 353 /** 354 * mix_acp_set_op_align: 355 * @obj: #MixAudioConfigParams object 356 * @op_align: One of the supported #MixACPOpAlign 357 * @returns: MIX_RESULT 358 * 359 * Set Output Alignment to one of the #MixACPOpAlign value. 360 */ 361 MIX_RESULT mix_acp_set_op_align(MixAudioConfigParams *obj, MixACPOpAlign op_align); 362 363 /* void mix_acp_print_params(MixAudioConfigParams *obj); */ 364 365 366 #endif /* __MIX_AUDIOCONFIGPARAMS_H__ */ 367 368