1/* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17#ifndef __M4VSS3GPP_INTERNALCONFIG_H__ 18#define __M4VSS3GPP_INTERNALCONFIG_H__ 19 20/** 21 ****************************************************************************** 22 * @file M4VSS3GPP_InternalConfig.h 23 * @brief This file contains some magical and configuration parameters. 24 ****************************************************************************** 25*/ 26 27/***********************/ 28/* VideoEdition config */ 29/***********************/ 30 31#define M4VSS3GPP_MINIMAL_TRANSITION_DURATION 100 /**< 100 milliseconds */ 32#define M4VSS3GPP_NB_AU_PREFETCH 4 /**< prefect 4 AUs */ 33#define M4VSS3GPP_NO_STSS_JUMP_POINT 40000 /**< If 3gp file does not contain 34 an STSS table (no rap frames), 35 jump backward 40 s maximum */ 36 37/*****************/ 38/* Writer config */ 39/*****************/ 40 41#define M4VSS3GPP_WRITER_AUDIO_STREAM_ID 1 42#define M4VSS3GPP_WRITER_VIDEO_STREAM_ID 2 43 44/**< Max AU size will be 0.8 times the YUV4:2:0 frame size */ 45#define M4VSS3GPP_VIDEO_MIN_COMPRESSION_RATIO 0.9F 46/**< Max chunk size will be 1.2 times the max AU size */ 47#define M4VSS3GPP_VIDEO_AU_SIZE_TO_CHUNCK_SIZE_RATIO 1.2F 48 49/** READ CAREFULLY IN CASE OF REPORTED RUNNING TROUBLES 50The max AU size is used to pre-set max size of AU that can be written in the 3GP writer 51For audio standard with variable AU size, there could be some encoding settings leading to AU size 52exceeding this limit. 53For AAC streams for instance the average AU size is given by: 54av AU size = (av bitrate * 1024)/(sampling freq) 55If VSS returns the message: 56>> ERROR: audio AU size (XXXX) to copy larger than allocated one (YYYY) => abort 57>> PLEASE CONTACT SUPPORT TO EXTEND MAX AU SIZE IN THE PRODUCT LIBRARY 58Error is most likely to happen when mixing with audio full replacement 59 */ 60/**< AAC max AU size - READ EXPLANATION ABOVE */ 61#define M4VSS3GPP_AUDIO_MAX_AU_SIZE 2048 62/**< set to x4 max AU size per chunk */ 63#define M4VSS3GPP_AUDIO_MAX_CHUNCK_SIZE 8192 64 65 66/***********************/ 67/* H263 / MPEG4 config */ 68/***********************/ 69 70#define M4VSS3GPP_EDIT_H263_MODULO_TIME 255 71 72#ifdef BIG_ENDIAN 73/**< 0xb3 01 00 00 Little endian / b00 00 00 01 b3 big endian*/ 74#define M4VSS3GPP_EDIT_GOV_HEADER 0x000001b3 75#else 76/**< 0xb3 01 00 00 Little endian / b00 00 00 01 b3 big endian*/ 77#define M4VSS3GPP_EDIT_GOV_HEADER 0xb3010000 78#endif 79 80/**************/ 81/* AMR config */ 82/**************/ 83 84#define M4VSS3GPP_WRITTEN_AMR_TRACK_TIME_SCALE 8000 85#define M4VSS3GPP_AMR_DECODED_PCM_SAMPLE_NUMBER 160 /**< 20ms at 8000hz --> 86 20x8=160 samples */ 87#define M4VSS3GPP_AMR_DEFAULT_BITRATE 12200 /**< 12.2 kbps */ 88 89/**************/ 90/* EVRC config */ 91/**************/ 92 93#define M4VSS3GPP_EVRC_DEFAULT_BITRATE 9200 /**< 9.2 kbps */ 94 95/**************/ 96/* MP3 config */ 97/**************/ 98 99/** Macro to make a jump on the MP3 track on several steps 100 To avoid to block the system with an long MP3 jump, this process 101 is divided on several steps. 102 */ 103#define M4VSS3GPP_MP3_JUMPED_AU_NUMBER_MAX 100 104 105/** Macro to define the number of read AU to analyse the bitrate 106 So the process will read the first n AU of the MP3 stream to get 107 the average bitrate. n is defined by this define. 108 */ 109#define M4VSS3GPP_MP3_AU_NUMBER_MAX 500 110 111/*****************************/ 112/* define AMR silence frames */ 113/*****************************/ 114 115#define M4VSS3GPP_AMR_AU_SILENCE_FRAME_048_SIZE 13 116#define M4VSS3GPP_AMR_AU_SILENCE_FRAME_048_DURATION 160 117 118#ifdef M4VSS3GPP_SILENCE_FRAMES 119const M4OSA_UInt8 M4VSS3GPP_AMR_AU_SILENCE_FRAME_048[M4VSS3GPP_AMR_AU_SILENCE_FRAME_048_SIZE] = 120{ 121 0x04, 0xFF, 0x18, 0xC7, 0xF0, 0x0D, 0x04, 0x33, 122 0xFF, 0xE0, 0x00, 0x00, 0x00 123}; 124#else 125extern const M4OSA_UInt8 \ 126 M4VSS3GPP_AMR_AU_SILENCE_FRAME_048[M4VSS3GPP_AMR_AU_SILENCE_FRAME_048_SIZE]; 127#endif 128 129/*****************************/ 130/* define AAC silence frames */ 131/*****************************/ 132 133#define M4VSS3GPP_AAC_AU_SILENCE_MONO_SIZE 4 134 135#ifdef M4VSS3GPP_SILENCE_FRAMES 136const M4OSA_UInt8 M4VSS3GPP_AAC_AU_SILENCE_MONO[M4VSS3GPP_AAC_AU_SILENCE_MONO_SIZE] = 137{ 138 0x00, 0xC8, 0x20, 0x07 139}; 140#else 141extern const M4OSA_UInt8 M4VSS3GPP_AAC_AU_SILENCE_MONO[M4VSS3GPP_AAC_AU_SILENCE_MONO_SIZE]; 142#endif 143 144#define M4VSS3GPP_AAC_AU_SILENCE_STEREO_SIZE 6 145 146#ifdef M4VSS3GPP_SILENCE_FRAMES 147const M4OSA_UInt8 M4VSS3GPP_AAC_AU_SILENCE_STEREO[M4VSS3GPP_AAC_AU_SILENCE_STEREO_SIZE] = 148{ 149 0x21, 0x10, 0x03, 0x20, 0x54, 0x1C 150}; 151#else 152extern const M4OSA_UInt8 M4VSS3GPP_AAC_AU_SILENCE_STEREO[M4VSS3GPP_AAC_AU_SILENCE_STEREO_SIZE]; 153#endif 154 155#endif /* __M4VSS3GPP_INTERNALCONFIG_H__ */ 156 157