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_ACP_AAC_H__ 10 #define __MIX_ACP_AAC_H__ 11 12 #include "mixacp.h" 13 14 /** 15 * MIX_TYPE_AUDIOCONFIGPARAMSAAC: 16 * 17 * Get type of class. 18 */ 19 #define MIX_TYPE_AUDIOCONFIGPARAMSAAC (mix_acp_aac_get_type ()) 20 21 /** 22 * MIX_AUDIOCONFIGPARAMSAAC: 23 * @obj: object to be type-casted. 24 * 25 * Type casting 26 */ 27 #define MIX_AUDIOCONFIGPARAMSAAC(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MIX_TYPE_AUDIOCONFIGPARAMSAAC, MixAudioConfigParamsAAC)) 28 29 /** 30 * MIX_IS_AUDIOCONFIGPARAMSAAC: 31 * @obj: an object. 32 * 33 * Checks if the given object is an instance of #MixAudioConfigParams 34 */ 35 #define MIX_IS_AUDIOCONFIGPARAMSAAC(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MIX_TYPE_AUDIOCONFIGPARAMSAAC)) 36 37 /** 38 * MIX_AUDIOCONFIGPARAMSAAC_CLASS: 39 * @klass: class to be type-casted. 40 * 41 * Type Casting. 42 */ 43 #define MIX_AUDIOCONFIGPARAMSAAC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MIX_TYPE_AUDIOCONFIGPARAMSAAC, MixAudioConfigParamsAACClass)) 44 45 /** 46 * MIX_IS_AUDIOCONFIGPARAMSAAC_CLASS: 47 * @klass: a class. 48 * 49 * Checks if the given class is #MixAudioConfigParamsClass 50 */ 51 #define MIX_IS_AUDIOCONFIGPARAMSAAC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MIX_TYPE_AUDIOCONFIGPARAMSAAC)) 52 53 /** 54 * MIX_AUDIOCONFIGPARAMSAAC_GET_CLASS: 55 * @obj: a #MixAudioConfigParams object. 56 * 57 * Get the class instance of the object. 58 */ 59 #define MIX_AUDIOCONFIGPARAMSAAC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), MIX_TYPE_AUDIOCONFIGPARAMSAAC, MixAudioConfigParamsAACClass)) 60 61 typedef struct _MixAudioConfigParamsAAC MixAudioConfigParamsAAC; 62 typedef struct _MixAudioConfigParamsAACClass MixAudioConfigParamsAACClass; 63 64 /** 65 * MixAACBitrateType: 66 * @MIX_AAC_BR_NULL: Undefined bit rate type. 67 * @MIX_AAC_BR_CONSTANT: Constant bit rate. 68 * @MIX_AAC_BR_VARIABLE: Variable bit rate. 69 * @MIX_AAC_BR_LAST: last entry. 70 * 71 * Types of bitrate in AAC. 72 */ 73 typedef enum { 74 MIX_AAC_BR_NULL=-1, 75 MIX_AAC_BR_CONSTANT=0, 76 MIX_AAC_BR_VARIABLE, 77 MIX_AAC_BR_LAST 78 } MixAACBitrateType; 79 80 /** 81 * MixAACBitstreamFormt: 82 * @MIX_AAC_BS_NULL: Undefined bitstream format. 83 * @MIX_AAC_BS_ADTS: Bitstream is in ADTS format. 84 * @MIX_AAC_BS_ADIF: Bitstream is in ADIF format. 85 * @MIX_AAC_BS_RAW: Bitstream is in raw format. 86 * @MIX_AAC_BS_LAST: Last entry. 87 * 88 * AAC bitstream format. 89 */ 90 typedef enum { 91 MIX_AAC_BS_NULL=-1, 92 MIX_AAC_BS_ADTS=0, 93 MIX_AAC_BS_ADIF, 94 MIX_AAC_BS_RAW, 95 MIX_AAC_BS_LAST 96 } MixAACBitstreamFormt; 97 98 /** 99 * MixAACProfile: 100 * @MIX_AAC_PROFILE_NULL: Undefined profile. 101 * @MIX_AAC_PROFILE_MAIN: <emphasis>Not Supported</emphasis> AAC Main profile. 102 * @MIX_AAC_PROFILE_LC: AAC-LC profile, including support of SBR and PS tool. 103 * @MIX_AAC_PROFILE_SSR: <emphasis>Not Supported</emphasis> SSR profile. 104 * @MIX_AAC_PROFILE_LAST: Last entry. 105 * 106 * AAC profiles definitions. 107 */ 108 typedef enum { 109 MIX_AAC_PROFILE_NULL=-1, 110 MIX_AAC_PROFILE_MAIN=0, 111 MIX_AAC_PROFILE_LC, 112 MIX_AAC_PROFILE_SSR, 113 MIX_AAC_PROFILE_LAST 114 } MixAACProfile; 115 116 /* Using enumeration as this MPEG ID definition is specific to SST and different from 117 any MPEG/ADTS header. 118 */ 119 /** 120 * MixAACMpegID: 121 * @MIX_AAC_MPEG_ID_NULL: Undefined MPEG ID. 122 * @MIX_AAC_MPEG_2_ID: Indicate MPEG 2 Audio. 123 * @MIX_AAC_MPEG_4_ID: Indicate MPEG 4 Audio. 124 * @MIX_AAC_MPEG_LAST: last entry. 125 * 126 * AAC MPEG ID. 127 */ 128 typedef enum { 129 MIX_AAC_MPEG_ID_NULL=-1, 130 MIX_AAC_MPEG_2_ID = 0, 131 MIX_AAC_MPEG_4_ID = 1, 132 MIX_AAC_MPEG_LAST 133 } MixAACMpegID; 134 135 /** 136 * MixAudioConfigParamsAAC: 137 * @parent: parent. 138 * @MPEG_id: MPEG ID. See #mix_acp_aac_set_mpeg_id 139 * @bit_stream_format: Bitstream format. See #mix_acp_aac_set_bit_stream_format. 140 * @aac_profile: AAC profile. See #mix_acp_aac_set_aac_profile. 141 * @aot: Audio object type. See #mix_acp_aac_set_aot 142 * @aac_sample_rate: See #MIX_ACP_AAC_SAMPLE_RATE macro. 143 * @aac_channels: See #MIX_ACP_AAC_CHANNELS macro. 144 * @bit_rate_type: Bitrate type. See #mix_acp_aac_set_bit_rate_type 145 * @sbrPresentFlag: See #MIX_ACP_AAC_SBR_FLAG macro. 146 * @psPresentFlag: See #MIX_ACP_AAC_PS_FLAG macro. 147 * @CRC: CRC check 0:disable, 1:enable. 148 * @pce_present: <emphasis>Not Used.</emphasis> See #MIX_ACP_AAC_PCE_FLAG 149 * @syntc_id: <emphasis>Not Used.</emphasis> 0 for ID_SCE(Dula Mono), -1 for raw. 150 * @syntc_tag: <emphasis>Not Used.</emphasis> -1 for raw. 0-16 for rest of the streams. 151 * @num_syntc_elems: <emphasis>Not Used.</emphasis> Number of syntatic elements. 152 * 153 * MixAudio Parameter object 154 */ 155 struct _MixAudioConfigParamsAAC 156 { 157 /*< public >*/ 158 MixAudioConfigParams parent; 159 160 /*< public >*/ 161 /* Audio Format Parameters */ 162 MixAACMpegID MPEG_id; 163 MixAACBitstreamFormt bit_stream_format; 164 MixAACProfile aac_profile; 165 guint aot; 166 guint aac_sample_rate; 167 guint aac_channels; 168 MixAACBitrateType bit_rate_type; 169 gboolean CRC; 170 guint sbrPresentFlag; 171 guint psPresentFlag; 172 gboolean pce_present; 173 gint8 syntc_id[2]; 174 gint8 syntc_tag[2]; 175 gint num_syntc_elems; 176 /*< private >*/ 177 void* reserved1; 178 void* reserved2; 179 void* reserved3; 180 void* reserved4; 181 }; 182 183 /** 184 * MixAudioConfigParamsAACClass: 185 * 186 * MI-X Audio object class 187 */ 188 struct _MixAudioConfigParamsAACClass 189 { 190 /*< public >*/ 191 MixAudioConfigParamsClass parent_class; 192 193 /* class members */ 194 }; 195 196 /** 197 * mix_acp_aac_get_type: 198 * @returns: type 199 * 200 * Get the type of object. 201 */ 202 GType mix_acp_aac_get_type (void); 203 204 /** 205 * mix_acp_aac_new: 206 * @returns: A newly allocated instance of #MixAudioConfigParamsAAC 207 * 208 * Use this method to create new instance of #MixAudioConfigParamsAAC 209 */ 210 MixAudioConfigParamsAAC *mix_acp_aac_new(void); 211 212 /** 213 * mix_acp_aac_ref: 214 * @mix: object to add reference 215 * @returns: the MixAudioConfigParamsAAC instance where reference count has been increased. 216 * 217 * Add reference count. 218 */ 219 MixAudioConfigParamsAAC *mix_acp_aac_ref(MixAudioConfigParamsAAC *mix); 220 221 /** 222 * mix_acp_aac_unref: 223 * @obj: object to unref. 224 * 225 * Decrement reference count of the object. 226 */ 227 #define mix_acp_aac_unref(obj) mix_params_unref(MIX_PARAMS(obj)) 228 229 /* Class Methods */ 230 231 232 /** 233 * mix_acp_aac_set_mpeg_id: 234 * @obj: #MixAudioConfigParamsAAC 235 * @mpegid: MPEG ID to set. 236 * @return: MIX_RESULT 237 * 238 * Configure decoder to treat audio as MPEG 2 or MPEG 4. 239 */ 240 MIX_RESULT mix_acp_aac_set_mpeg_id(MixAudioConfigParamsAAC *obj, MixAACMpegID mpegid); 241 242 /** 243 * mix_acp_aac_get_mpeg_id: 244 * @obj: #MixAudioConfigParamsAAC object 245 * @returns: MPEG ID. 246 * 247 * Retrieve currently configured mpeg id value. 248 */ 249 MixAACMpegID mix_acp_aac_get_mpeg_id(MixAudioConfigParamsAAC *obj); 250 251 /** 252 * MIX_ACP_AAC_CRC: 253 * @obj: #MixAudioConfigParamsAAC object. 254 * 255 * #MixAudioConfigParamAAC.CRC accessor. 256 */ 257 #define MIX_ACP_AAC_CRC(obj) (MIX_AUDIOCONFIGPARAMSAAC(obj)->CRC) 258 259 /** 260 * mix_acp_aac_set_aot: 261 * @obj: #MixAudioConfigParamsAAC 262 * @aot: Audio Object Type. 263 * 264 * Audio Object Type for the MPEG-4 audio stream. Valid value are: 265 * 266 * 2 - for AAC-LC 267 * 268 * 5 - for SBR 269 * 270 * Method returns MIX_RESULT_NOT_SUPPORTED for not supported value. 271 * 272 */ 273 MIX_RESULT mix_acp_aac_set_aot(MixAudioConfigParamsAAC *obj, guint aot); 274 275 /** 276 * mix_acp_aac_get_aot: 277 * @obj: #MixAudioConfigParamsAAC 278 * @aot: Pointer to receive the Audio Object Type. 279 * @return: Currently configured audio object type. Or 0 if not yet specified. 280 * 281 * To retrieve currently configured audio object type. 282 */ 283 guint mix_acp_aac_get_aot(MixAudioConfigParamsAAC *obj); 284 285 /** 286 * MIX_ACP_AAC_SBR_FLAG: 287 * @obj: #MixAudioConfigParamsAAC object 288 * 289 * MixAudioConfigParamAAC.sbrPresentFlag accessor. 290 * 291 * Applicable only when @bit_stream_format==#MIX_AAC_BS_RAW. Indicates whether SBR data is present. 292 * 293 * 0: Absent 294 * 295 * 1: Present 296 * 297 * -1 (0xffffffff): indicates implicit signalling. 298 */ 299 #define MIX_ACP_AAC_SBR_FLAG(obj) (MIX_AUDIOCONFIGPARAMSAAC(obj)->sbrPresentFlag) 300 301 /** 302 * MIX_ACP_AAC_PS_FLAG: 303 * @obj: #MixAudioConfigParamsAAC object 304 * 305 * MixAudioConfigParamAAC.psPresentFlag accessor. 306 * 307 * Applicable only when @bit_stream_format==#MIX_AAC_BS_RAW. Indicates whether PS data is present. 308 * 309 * 0: Absent 310 * 311 * 1: Present 312 * 313 * -1 (0xffffffff): indicates implicit signalling. 314 */ 315 #define MIX_ACP_AAC_PS_FLAG(obj) (MIX_AUDIOCONFIGPARAMSAAC(obj)->psPresentFlag) 316 317 /** 318 * MIX_ACP_AAC_PCE_FLAG: 319 * @obj: #MixAudioConfigParamsAAC object. 320 * 321 * MixAudioConfigParamAAC.pce_present accessor. 322 * 323 * Applicable only when @bit_stream_format==#MIX_AAC_BS_RAW. Indicates PCE data presence. 324 * 325 * 1:present 326 * 327 * 0:absent. 328 * 329 * <remark>Not Used on Moorestown.</remark> 330 */ 331 #define MIX_ACP_AAC_PCE_FLAG(obj) (MIX_AUDIOCONFIGPARAMSAAC(obj)->pce_present) 332 333 /** 334 * MIX_ACP_AAC_SAMPLE_RATE: 335 * @obj: #MixAudioConfigParamsAAC object. 336 * 337 * MixAudioConfigParamAAC.aac_sample_rate accessor. 338 * 339 * Plain AAC decoder operating sample rate. Which could be different from the output sampling rate with HE AAC v1 and v2. 340 */ 341 #define MIX_ACP_AAC_SAMPLE_RATE(obj) (MIX_AUDIOCONFIGPARAMSAAC(obj)->aac_sample_rate) 342 343 /** 344 * MIX_ACP_AAC_CHANNELS: 345 * @obj: #MixAudioConfigParamsAAC 346 * 347 * MixAudioConfigParamAAC.aac_channels accessor. 348 * 349 * Indicates the number of output channels used by AAC decoder before SBR or PS tools are applied. 350 * 351 */ 352 #define MIX_ACP_AAC_CHANNELS(obj) (MIX_AUDIOCONFIGPARAMSAAC(obj)->aac_channels) 353 354 /** 355 * mix_acp_aac_get_bit_stream_format: 356 * @obj: #MixAudioConfigParamsAAC 357 * @returns: #MixAACBitstreamFormt 358 * 359 * Return the bitstream format currently configured. 360 */ 361 MixAACBitstreamFormt mix_acp_aac_get_bit_stream_format(MixAudioConfigParamsAAC *obj); 362 363 /** 364 * mix_acp_aac_set_bit_stream_format: 365 * @obj: #MixAudioConfigParamsAAC 366 * @bit_stream_format: Bit stream format. 367 * @returns: MIX_RESULT 368 * 369 * Set the type of bitstream format as specified in #MixAACBitstreamFormt. 370 */ 371 MIX_RESULT mix_acp_aac_set_bit_stream_format(MixAudioConfigParamsAAC *obj, MixAACBitstreamFormt bit_stream_format); 372 373 /** 374 * mix_acp_aac_get_aac_profile: 375 * @obj: #MixAudioConfigParamsAAC 376 * @returns: #MixAACProfile 377 * 378 * Retrieve the AAC profile currently configured. 379 */ 380 MixAACProfile mix_acp_aac_get_aac_profile(MixAudioConfigParamsAAC *obj); 381 382 /** 383 * mix_acp_aac_set_aac_profile: 384 * @obj: #MixAudioConfigParamsAAC 385 * @aac_profile: AAC profile to set. 386 * @returns: MIX_RESULT 387 * 388 * Configure AAC profile for current session. 389 * 390 * Only #MIX_AAC_PROFILE_LC is supported in Moorestown. 391 */ 392 MIX_RESULT mix_acp_aac_set_aac_profile(MixAudioConfigParamsAAC *obj, MixAACProfile aac_profile); 393 394 /** 395 * mix_acp_aac_get_bit_rate_type: 396 * @obj: #MixAudioConfigParamsAAC 397 * @returns: #MixAACBitrateType 398 * 399 * Retrieve the bit rate type currently configured. 400 */ 401 MixAACBitrateType mix_acp_aac_get_bit_rate_type(MixAudioConfigParamsAAC *obj); 402 403 /** 404 * mix_acp_aac_set_bit_rate_type: 405 * @obj: #MixAudioConfigParamsAAC 406 * @bit_rate_type: Bit rate type to set. 407 * @returns: MIX_RESULT 408 * 409 * Set the bit rate type used. 410 */ 411 MIX_RESULT mix_acp_aac_set_bit_rate_type(MixAudioConfigParamsAAC *obj, MixAACBitrateType bit_rate_type); 412 413 #endif /* __MIX_AUDIOCONFIGPARAMSAAC_H__ */ 414